| 24383 |
amit.gupta |
1 |
package com.spice.profitmandi.dao.repository.cs;
|
| 24500 |
govind |
2 |
|
| 24383 |
amit.gupta |
3 |
import java.time.LocalDateTime;
|
| 24417 |
govind |
4 |
import java.util.ArrayList;
|
|
|
5 |
import java.util.HashMap;
|
| 24439 |
govind |
6 |
import java.util.HashSet;
|
| 24417 |
govind |
7 |
import java.util.List;
|
|
|
8 |
import java.util.Map;
|
| 25570 |
tejbeer |
9 |
import java.util.Set;
|
|
|
10 |
import java.util.stream.Collectors;
|
| 24500 |
govind |
11 |
|
| 25570 |
tejbeer |
12 |
import org.apache.commons.collections4.map.HashedMap;
|
| 24439 |
govind |
13 |
import org.apache.commons.lang.RandomStringUtils;
|
|
|
14 |
import org.apache.logging.log4j.LogManager;
|
|
|
15 |
import org.apache.logging.log4j.Logger;
|
| 24383 |
amit.gupta |
16 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 25726 |
amit.gupta |
17 |
import org.springframework.cache.annotation.Cacheable;
|
| 24439 |
govind |
18 |
import org.springframework.mail.javamail.JavaMailSender;
|
| 24383 |
amit.gupta |
19 |
import org.springframework.stereotype.Component;
|
| 24701 |
govind |
20 |
|
| 24383 |
amit.gupta |
21 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 24417 |
govind |
22 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 24439 |
govind |
23 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
|
|
24 |
import com.spice.profitmandi.common.util.Utils;
|
| 24417 |
govind |
25 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 24383 |
amit.gupta |
26 |
import com.spice.profitmandi.dao.entity.cs.Activity;
|
| 24417 |
govind |
27 |
import com.spice.profitmandi.dao.entity.cs.PartnerRegion;
|
|
|
28 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
| 24471 |
govind |
29 |
import com.spice.profitmandi.dao.entity.cs.Region;
|
| 24383 |
amit.gupta |
30 |
import com.spice.profitmandi.dao.entity.cs.Ticket;
|
| 24500 |
govind |
31 |
import com.spice.profitmandi.dao.entity.cs.TicketAssigned;
|
| 24439 |
govind |
32 |
import com.spice.profitmandi.dao.entity.cs.TicketCategory;
|
| 24417 |
govind |
33 |
import com.spice.profitmandi.dao.entity.cs.TicketSubCategory;
|
| 24383 |
amit.gupta |
34 |
import com.spice.profitmandi.dao.entity.fofo.ActivityType;
|
| 24417 |
govind |
35 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
|
|
36 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 25570 |
tejbeer |
37 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 26418 |
tejbeer |
38 |
import com.spice.profitmandi.dao.repository.dtr.LeadRepository;
|
|
|
39 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
|
|
40 |
import com.spice.profitmandi.dao.repository.fofo.HygieneDataRepository;
|
|
|
41 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
|
|
42 |
import com.spice.profitmandi.service.PartnerInvestmentService;
|
| 24417 |
govind |
43 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 24383 |
amit.gupta |
44 |
|
|
|
45 |
@Component
|
|
|
46 |
public class CsServiceImpl implements CsService {
|
| 24417 |
govind |
47 |
|
| 24439 |
govind |
48 |
private static final Logger LOGGER = LogManager.getLogger(CsServiceImpl.class);
|
|
|
49 |
|
| 24570 |
govind |
50 |
private static final String ASSIGNED_TICKET = "Dear %s,You have assigned a ticket by %s with ticketId#%s.Regards\nSmartdukaan";
|
| 24439 |
govind |
51 |
private static final String ASSINMENT_SUBJECT = "Assignment Ticket";
|
|
|
52 |
|
| 24383 |
amit.gupta |
53 |
@Autowired
|
|
|
54 |
TicketRepository ticketRepository;
|
| 24417 |
govind |
55 |
|
| 24383 |
amit.gupta |
56 |
@Autowired
|
| 24439 |
govind |
57 |
JavaMailSender mailSender;
|
|
|
58 |
|
|
|
59 |
@Autowired
|
| 24383 |
amit.gupta |
60 |
TicketCategoryRepository ticketCategoryRepository;
|
| 24417 |
govind |
61 |
|
| 24383 |
amit.gupta |
62 |
@Autowired
|
|
|
63 |
TicketSubCategoryRepository ticketSubCategoryRepository;
|
| 24417 |
govind |
64 |
|
|
|
65 |
@Autowired
|
| 24388 |
amit.gupta |
66 |
ActivityRepository activityRepository;
|
| 24417 |
govind |
67 |
|
|
|
68 |
@Autowired
|
| 24439 |
govind |
69 |
PartnerRegionRepository partnerRegionRepository;
|
| 24417 |
govind |
70 |
|
|
|
71 |
@Autowired
|
|
|
72 |
private PositionRepository positionRepository;
|
|
|
73 |
|
|
|
74 |
@Autowired
|
|
|
75 |
private AuthRepository authRepository;
|
|
|
76 |
|
|
|
77 |
@Autowired
|
|
|
78 |
private RetailerService retailerService;
|
| 24500 |
govind |
79 |
|
| 24471 |
govind |
80 |
@Autowired
|
|
|
81 |
private RegionRepository regionRepository;
|
| 24417 |
govind |
82 |
|
| 24500 |
govind |
83 |
@Autowired
|
|
|
84 |
private TicketAssignedRepository ticketAssignedRepository;
|
|
|
85 |
|
| 25570 |
tejbeer |
86 |
@Autowired
|
|
|
87 |
private PartnersPositionRepository partnersPositionRepository;
|
|
|
88 |
|
|
|
89 |
@Autowired
|
|
|
90 |
private FofoStoreRepository fofoStoreRepository;
|
|
|
91 |
|
| 26418 |
tejbeer |
92 |
@Autowired
|
|
|
93 |
private FofoOrderItemRepository fofoOrderItemRepository;
|
|
|
94 |
|
|
|
95 |
@Autowired
|
|
|
96 |
private LeadRepository leadRepository;
|
|
|
97 |
|
|
|
98 |
@Autowired
|
|
|
99 |
private HygieneDataRepository hygieneDataRepository;
|
|
|
100 |
|
|
|
101 |
@Autowired
|
|
|
102 |
private PartnerInvestmentService partnerInvestmentService;
|
|
|
103 |
|
|
|
104 |
@Autowired
|
|
|
105 |
private PartnerDailyInvestmentRepository partnerDailyInvestmentRepository;
|
|
|
106 |
|
| 24383 |
amit.gupta |
107 |
@Override
|
| 24439 |
govind |
108 |
public void createTicket(int fofoId, int categoryId, int subcategoryId, String message)
|
|
|
109 |
throws ProfitMandiBusinessException {
|
| 24417 |
govind |
110 |
|
| 24383 |
amit.gupta |
111 |
ActivityType type = ActivityType.OPENED;
|
| 24439 |
govind |
112 |
EscalationType escalationTypeL1 = EscalationType.L1;
|
|
|
113 |
EscalationType escalationTypeL2 = EscalationType.L2;
|
|
|
114 |
EscalationType escalationTypeL3 = EscalationType.L3;
|
| 24383 |
amit.gupta |
115 |
Ticket ticket = new Ticket();
|
| 24500 |
govind |
116 |
TicketAssigned ticketAssigned = new TicketAssigned();
|
| 24383 |
amit.gupta |
117 |
ticket.setSubCategoryId(subcategoryId);
|
| 24417 |
govind |
118 |
ticket.setFofoId(fofoId);
|
| 24383 |
amit.gupta |
119 |
ticket.setCreateTimestamp(LocalDateTime.now());
|
| 24417 |
govind |
120 |
ticket.setUpdateTimestamp(LocalDateTime.now());
|
| 24467 |
govind |
121 |
ticket.setL2EscalationTimestamp(ticket.getUpdateTimestamp().plusDays(2));
|
|
|
122 |
ticket.setL3EscalationTimestamp(ticket.getL2EscalationTimestamp().plusDays(2));
|
|
|
123 |
ticket.setLastEscalationTimestamp(ticket.getL3EscalationTimestamp().plusDays(2));
|
| 24439 |
govind |
124 |
ticket.setHappyCode(getRandomString());
|
|
|
125 |
int l1Auth = this.getAuthUserId(categoryId, escalationTypeL1, fofoId);
|
| 24699 |
govind |
126 |
LOGGER.info("l1Auth" + l1Auth);
|
| 24439 |
govind |
127 |
int l2Auth = this.getAuthUserId(categoryId, escalationTypeL2, fofoId);
|
| 24699 |
govind |
128 |
LOGGER.info("l2Auth" + l2Auth);
|
| 24557 |
govind |
129 |
int l3Auth = this.getAuthUserId(categoryId, escalationTypeL3, fofoId);
|
| 24699 |
govind |
130 |
LOGGER.info("l3Auth" + l3Auth);
|
| 24439 |
govind |
131 |
if (l1Auth == 0) {
|
|
|
132 |
if (l2Auth == 0) {
|
| 24500 |
govind |
133 |
this.setAssignment(ticket, ticketAssigned);
|
| 24439 |
govind |
134 |
} else {
|
| 24500 |
govind |
135 |
ticketAssigned.setAssineeId(l2Auth);
|
| 24526 |
govind |
136 |
ticket.setL1AuthUser(l2Auth);
|
|
|
137 |
ticket.setL2AuthUser(l2Auth);
|
| 24439 |
govind |
138 |
}
|
|
|
139 |
} else {
|
| 24500 |
govind |
140 |
ticketAssigned.setAssineeId(l1Auth);
|
| 24439 |
govind |
141 |
ticket.setL1AuthUser(l1Auth);
|
|
|
142 |
ticket.setL2AuthUser(l2Auth);
|
|
|
143 |
}
|
| 24699 |
govind |
144 |
if (ticket.getL2AuthUser() == 0) {
|
| 24569 |
govind |
145 |
ticket.setL2AuthUser(l3Auth);
|
|
|
146 |
}
|
| 24439 |
govind |
147 |
ticket.setL3AuthUser(l3Auth);
|
|
|
148 |
ticketRepository.persist(ticket);
|
| 24500 |
govind |
149 |
ticketAssigned.setTicketId(ticket.getId());
|
|
|
150 |
ticketAssignedRepository.persist(ticketAssigned);
|
|
|
151 |
AuthUser authUser = authRepository.selectById(ticketAssigned.getAssineeId());
|
| 24569 |
govind |
152 |
this.sendAssignedTicketMail(authUser, ticket);
|
| 24383 |
amit.gupta |
153 |
Activity activity = this.createActivity(type, message, 0);
|
|
|
154 |
this.addActivity(ticket.getId(), activity);
|
|
|
155 |
}
|
|
|
156 |
|
|
|
157 |
private Activity createActivity(ActivityType activityType, String message, int createdBy) {
|
|
|
158 |
Activity activity = new Activity();
|
|
|
159 |
activity.setMessage(message);
|
|
|
160 |
activity.setCreatedBy(createdBy);
|
|
|
161 |
activity.setType(activityType);
|
| 24417 |
govind |
162 |
activity.setCreateTimestamp(LocalDateTime.now());
|
| 24383 |
amit.gupta |
163 |
return activity;
|
|
|
164 |
}
|
| 24417 |
govind |
165 |
|
| 24439 |
govind |
166 |
private int getAuthUserId(int categoryId, EscalationType escalationType, int fofoId) {
|
| 24417 |
govind |
167 |
|
| 24439 |
govind |
168 |
List<Position> positions = null;
|
|
|
169 |
if (escalationType == EscalationType.L3) {
|
|
|
170 |
positions = positionRepository.selectPositionbyCategoryIdAndEscalationType(0, escalationType, 0);
|
|
|
171 |
} else {
|
|
|
172 |
List<PartnerRegion> regions = partnerRegionRepository.selectByfofoId(fofoId);
|
|
|
173 |
LOGGER.info("regions=" + regions);
|
| 24500 |
govind |
174 |
if (regions.size() == 0) {
|
|
|
175 |
regions = partnerRegionRepository.selectByfofoId(0);
|
| 24452 |
govind |
176 |
LOGGER.info("regions=" + regions);
|
|
|
177 |
}
|
| 24439 |
govind |
178 |
for (PartnerRegion region : regions) {
|
| 24699 |
govind |
179 |
LOGGER.info(categoryId + ":" + escalationType + ":" + region.getRegionId());
|
| 24439 |
govind |
180 |
positions = positionRepository.selectPositionbyCategoryIdAndEscalationType(categoryId, escalationType,
|
|
|
181 |
region.getRegionId());
|
|
|
182 |
LOGGER.info("positions:-" + positions);
|
| 24500 |
govind |
183 |
if (positions.size() > 0) {
|
| 24439 |
govind |
184 |
break;
|
|
|
185 |
}
|
|
|
186 |
|
|
|
187 |
}
|
|
|
188 |
if (positions.size() == 0) {
|
| 24557 |
govind |
189 |
if (escalationType == EscalationType.L1) {
|
|
|
190 |
regions = partnerRegionRepository.selectByfofoId(0);
|
|
|
191 |
LOGGER.info("regions=" + regions);
|
|
|
192 |
for (PartnerRegion region : regions) {
|
|
|
193 |
positions = positionRepository.selectPositionbyCategoryIdAndEscalationType(categoryId,
|
|
|
194 |
escalationType, region.getRegionId());
|
|
|
195 |
LOGGER.info("positions:-" + positions);
|
|
|
196 |
if (positions.size() > 0) {
|
|
|
197 |
break;
|
|
|
198 |
}
|
|
|
199 |
}
|
|
|
200 |
} else {
|
|
|
201 |
regions = partnerRegionRepository.selectByfofoId(0);
|
|
|
202 |
LOGGER.info("regions=" + regions);
|
|
|
203 |
for (PartnerRegion region : regions) {
|
|
|
204 |
positions = positionRepository.selectPositionbyCategoryIdAndEscalationType(categoryId,
|
|
|
205 |
escalationType, region.getRegionId());
|
|
|
206 |
LOGGER.info("positions:-" + positions);
|
|
|
207 |
if (positions.size() > 0) {
|
|
|
208 |
break;
|
|
|
209 |
}
|
|
|
210 |
}
|
|
|
211 |
}
|
| 24439 |
govind |
212 |
}
|
| 24699 |
govind |
213 |
|
| 24439 |
govind |
214 |
}
|
| 24699 |
govind |
215 |
if (positions.size() == 0) {
|
| 24557 |
govind |
216 |
return 0;
|
|
|
217 |
}
|
|
|
218 |
LOGGER.info(positions.get(0).getAuthUserId());
|
| 24439 |
govind |
219 |
return positions.get(0).getAuthUserId();
|
| 24417 |
govind |
220 |
/*
|
|
|
221 |
* if(ActivityType.escalationTypes.contains(escalationType)) {
|
|
|
222 |
* //escalationMatrix } else { throw new
|
|
|
223 |
* ProfitMandiBusinessException("SubCategory", subcategoryId,
|
|
|
224 |
* "Could not find Assignee for "); }
|
|
|
225 |
*/
|
| 24439 |
govind |
226 |
|
| 24383 |
amit.gupta |
227 |
}
|
|
|
228 |
|
|
|
229 |
@Override
|
|
|
230 |
public void addActivity(int ticketId, Activity activity) {
|
|
|
231 |
activity.setTicketId(ticketId);
|
| 24417 |
govind |
232 |
activityRepository.persist(activity);
|
| 24383 |
amit.gupta |
233 |
}
|
|
|
234 |
|
| 24439 |
govind |
235 |
private String getRandomString() {
|
|
|
236 |
int length = 4;
|
|
|
237 |
boolean useLetters = false;
|
|
|
238 |
boolean useNumbers = true;
|
|
|
239 |
String generatedString = RandomStringUtils.random(length, useLetters, useNumbers);
|
|
|
240 |
return generatedString;
|
|
|
241 |
}
|
|
|
242 |
|
| 24417 |
govind |
243 |
@Override
|
|
|
244 |
public void addPartnerToRegion(int regionId, List<Integer> fofoIds) {
|
|
|
245 |
|
| 24557 |
govind |
246 |
for (int fofoId : fofoIds) {
|
|
|
247 |
PartnerRegion partnerRegion = new PartnerRegion();
|
|
|
248 |
partnerRegion.setFofoId(fofoId);
|
|
|
249 |
partnerRegion.setRegionId(regionId);
|
|
|
250 |
partnerRegionRepository.persist(partnerRegion);
|
| 24417 |
govind |
251 |
}
|
|
|
252 |
}
|
|
|
253 |
|
|
|
254 |
@Override
|
| 24500 |
govind |
255 |
public Map<Integer, AuthUser> getAuthUserIdAndAuthUserMap(List<TicketAssigned> ticketAssigneds) {
|
| 24417 |
govind |
256 |
Map<Integer, AuthUser> authUserIdAndAuthUserMap = new HashMap<>();
|
| 24500 |
govind |
257 |
|
|
|
258 |
for (TicketAssigned ticketAssigned : ticketAssigneds) {
|
|
|
259 |
AuthUser authUser = authRepository.selectById(ticketAssigned.getAssineeId());
|
|
|
260 |
authUserIdAndAuthUserMap.put(ticketAssigned.getTicketId(), authUser);
|
|
|
261 |
}
|
|
|
262 |
return authUserIdAndAuthUserMap;
|
|
|
263 |
}
|
|
|
264 |
|
|
|
265 |
@Override
|
|
|
266 |
public Map<Integer, AuthUser> getTicketIdAndAuthUserMapUsingTickets(List<Ticket> tickets) {
|
|
|
267 |
Map<Integer, AuthUser> authUserIdAndAuthUserMap = new HashMap<>();
|
|
|
268 |
|
| 24417 |
govind |
269 |
for (Ticket ticket : tickets) {
|
| 24500 |
govind |
270 |
AuthUser authUser = authRepository.selectById(ticket.getL1AuthUser());
|
|
|
271 |
authUserIdAndAuthUserMap.put(ticket.getId(), authUser);
|
| 24417 |
govind |
272 |
}
|
|
|
273 |
return authUserIdAndAuthUserMap;
|
|
|
274 |
}
|
|
|
275 |
|
|
|
276 |
@Override
|
|
|
277 |
public Map<Integer, TicketSubCategory> getSubCategoryIdAndSubCategoryMap(List<Ticket> tickets) {
|
|
|
278 |
Map<Integer, TicketSubCategory> subCategoryIdAndSubCategoryMap = new HashMap<>();
|
| 24699 |
govind |
279 |
if (tickets != null) {
|
|
|
280 |
for (Ticket ticket : tickets) {
|
|
|
281 |
TicketSubCategory ticketSubCategory = ticketSubCategoryRepository.selectById(ticket.getSubCategoryId());
|
|
|
282 |
subCategoryIdAndSubCategoryMap.put(ticket.getSubCategoryId(), ticketSubCategory);
|
|
|
283 |
}
|
| 24417 |
govind |
284 |
}
|
|
|
285 |
return subCategoryIdAndSubCategoryMap;
|
|
|
286 |
}
|
|
|
287 |
|
|
|
288 |
@Override
|
|
|
289 |
public Map<Integer, CustomRetailer> getPartnerByFofoIds(List<Ticket> tickets) {
|
|
|
290 |
List<Integer> fofoIds = new ArrayList<>();
|
| 24569 |
govind |
291 |
LOGGER.info(tickets);
|
| 24699 |
govind |
292 |
if (tickets == null) {
|
| 24569 |
govind |
293 |
return null;
|
|
|
294 |
}
|
| 24417 |
govind |
295 |
for (Ticket ticket : tickets) {
|
|
|
296 |
fofoIds.add(ticket.getFofoId());
|
|
|
297 |
}
|
| 24699 |
govind |
298 |
Map<Integer, CustomRetailer> fofoIdsAndCustomRetailer = retailerService.getFofoRetailers(fofoIds);
|
| 24417 |
govind |
299 |
return fofoIdsAndCustomRetailer;
|
|
|
300 |
}
|
|
|
301 |
|
| 24439 |
govind |
302 |
@Override
|
|
|
303 |
public List<TicketCategory> getAllTicketCategotyFromSubCategory() {
|
|
|
304 |
|
|
|
305 |
List<TicketSubCategory> ticketSubCategories = ticketSubCategoryRepository.selectAll();
|
|
|
306 |
HashSet<Integer> categoryIds = new HashSet<>();
|
|
|
307 |
for (TicketSubCategory ticketSubcategory : ticketSubCategories) {
|
|
|
308 |
categoryIds.add(ticketSubcategory.getcategoryId());
|
|
|
309 |
}
|
|
|
310 |
List<TicketCategory> ticketcategories = ticketCategoryRepository.selectAll(new ArrayList<>(categoryIds));
|
|
|
311 |
return ticketcategories;
|
|
|
312 |
}
|
|
|
313 |
|
| 24500 |
govind |
314 |
private Ticket setAssignment(Ticket ticket, TicketAssigned ticketAssigned) {
|
| 24439 |
govind |
315 |
TicketCategory ticketCategory = ticketCategoryRepository.selectByName(ProfitMandiConstants.CRM);
|
|
|
316 |
List<Position> positions = positionRepository.selectPositionByCategoryId(ticketCategory.getId());
|
|
|
317 |
for (Position position : positions) {
|
|
|
318 |
if (position.getEscalationType().equals(EscalationType.L1)) {
|
| 24500 |
govind |
319 |
ticketAssigned.setAssineeId(position.getAuthUserId());
|
| 24439 |
govind |
320 |
ticket.setL1AuthUser(position.getAuthUserId());
|
| 24557 |
govind |
321 |
} else if (position.getEscalationType().equals(EscalationType.L2)) {
|
| 24439 |
govind |
322 |
ticket.setL2AuthUser(position.getAuthUserId());
|
|
|
323 |
}
|
|
|
324 |
}
|
|
|
325 |
return ticket;
|
|
|
326 |
}
|
| 24500 |
govind |
327 |
|
| 24471 |
govind |
328 |
@Override
|
|
|
329 |
public Map<Integer, AuthUser> getAuthUserIdAndAuthUserMapUsingPositions(List<Position> positions) {
|
|
|
330 |
Map<Integer, AuthUser> authUserIdAndAuthUserMap = new HashMap<>();
|
|
|
331 |
for (Position position : positions) {
|
|
|
332 |
AuthUser authUser = authRepository.selectById(position.getAuthUserId());
|
|
|
333 |
authUserIdAndAuthUserMap.put(position.getAuthUserId(), authUser);
|
|
|
334 |
}
|
|
|
335 |
return authUserIdAndAuthUserMap;
|
|
|
336 |
}
|
| 24500 |
govind |
337 |
|
| 24471 |
govind |
338 |
@Override
|
|
|
339 |
public Map<Integer, TicketCategory> getCategoryIdAndCategoryUsingPositions(List<Position> positions) {
|
|
|
340 |
Map<Integer, TicketCategory> categoryIdAndCategoryMap = new HashMap<>();
|
|
|
341 |
for (Position position : positions) {
|
| 24500 |
govind |
342 |
TicketCategory ticketCategory = ticketCategoryRepository.selectById(position.getCategoryId());
|
| 24471 |
govind |
343 |
categoryIdAndCategoryMap.put(position.getCategoryId(), ticketCategory);
|
|
|
344 |
}
|
|
|
345 |
return categoryIdAndCategoryMap;
|
|
|
346 |
}
|
| 24439 |
govind |
347 |
|
| 24471 |
govind |
348 |
@Override
|
|
|
349 |
public Map<Integer, Region> getRegionIdAndRegionMap(List<Position> positions) {
|
|
|
350 |
Map<Integer, Region> regionIdAndRegionMap = new HashMap<>();
|
|
|
351 |
for (Position position : positions) {
|
| 24500 |
govind |
352 |
Region region = regionRepository.selectById(position.getRegionId());
|
| 24471 |
govind |
353 |
regionIdAndRegionMap.put(position.getRegionId(), region);
|
|
|
354 |
}
|
|
|
355 |
return regionIdAndRegionMap;
|
|
|
356 |
}
|
| 24500 |
govind |
357 |
|
|
|
358 |
@Override
|
| 24699 |
govind |
359 |
public Map<Integer, List<AuthUser>> getAuthUserList(List<Ticket> tickets, AuthUser authUser) {
|
| 24500 |
govind |
360 |
Map<Integer, List<AuthUser>> authUserListMap = new HashMap<>();
|
|
|
361 |
for (Ticket ticket : tickets) {
|
| 24570 |
govind |
362 |
if (ticket.getL2AuthUser() == authUser.getId()) {
|
| 24500 |
govind |
363 |
List<AuthUser> authUsers = new ArrayList<>();
|
|
|
364 |
authUsers.add(authRepository.selectById(ticket.getL1AuthUser()));
|
|
|
365 |
authUserListMap.put(ticket.getId(), authUsers);
|
|
|
366 |
|
| 24570 |
govind |
367 |
} else if (ticket.getL3AuthUser() == authUser.getId()) {
|
| 24500 |
govind |
368 |
TicketAssigned ticketAssigned = ticketAssignedRepository
|
|
|
369 |
.selectByAssigneeIdAndTicketId(ticket.getL2AuthUser(), ticket.getId());
|
|
|
370 |
if (ticketAssigned == null) {
|
|
|
371 |
List<AuthUser> authUsers = new ArrayList<>();
|
|
|
372 |
authUsers.add(authRepository.selectById(ticket.getL1AuthUser()));
|
|
|
373 |
authUserListMap.put(ticket.getId(), authUsers);
|
|
|
374 |
} else {
|
|
|
375 |
List<AuthUser> authUsers = new ArrayList<>();
|
|
|
376 |
authUsers.add(authRepository.selectById(ticket.getL1AuthUser()));
|
|
|
377 |
authUsers.add(authRepository.selectById(ticket.getL2AuthUser()));
|
|
|
378 |
authUserListMap.put(ticket.getId(), authUsers);
|
|
|
379 |
}
|
|
|
380 |
} else {
|
|
|
381 |
TicketAssigned ticketAssigned = ticketAssignedRepository
|
|
|
382 |
.selectByAssigneeIdAndTicketId(ticket.getL3AuthUser(), ticket.getId());
|
|
|
383 |
if (ticketAssigned == null) {
|
|
|
384 |
ticketAssigned = ticketAssignedRepository.selectByAssigneeIdAndTicketId(ticket.getL2AuthUser(),
|
|
|
385 |
ticket.getId());
|
|
|
386 |
if (ticketAssigned == null) {
|
|
|
387 |
List<AuthUser> authUsers = new ArrayList<>();
|
|
|
388 |
authUsers.add(authRepository.selectById(ticket.getL1AuthUser()));
|
|
|
389 |
authUserListMap.put(ticket.getId(), authUsers);
|
|
|
390 |
} else {
|
|
|
391 |
List<AuthUser> authUsers = new ArrayList<>();
|
|
|
392 |
authUsers.add(authRepository.selectById(ticket.getL1AuthUser()));
|
|
|
393 |
authUsers.add(authRepository.selectById(ticket.getL2AuthUser()));
|
|
|
394 |
authUserListMap.put(ticket.getId(), authUsers);
|
|
|
395 |
}
|
|
|
396 |
} else {
|
|
|
397 |
List<AuthUser> authUsers = new ArrayList<>();
|
|
|
398 |
authUsers.add(authRepository.selectById(ticket.getL1AuthUser()));
|
|
|
399 |
authUsers.add(authRepository.selectById(ticket.getL2AuthUser()));
|
|
|
400 |
authUsers.add(authRepository.selectById(ticket.getL3AuthUser()));
|
|
|
401 |
authUserListMap.put(ticket.getId(), authUsers);
|
|
|
402 |
|
|
|
403 |
}
|
|
|
404 |
}
|
|
|
405 |
}
|
|
|
406 |
return authUserListMap;
|
|
|
407 |
}
|
| 24557 |
govind |
408 |
|
| 24500 |
govind |
409 |
@Override
|
| 24557 |
govind |
410 |
public void updateTicket(int categoryId, int subCategoryId, Ticket ticket) throws ProfitMandiBusinessException {
|
|
|
411 |
TicketAssigned ticketAssigned = new TicketAssigned();
|
| 24500 |
govind |
412 |
ticket.setSubCategoryId(subCategoryId);
|
|
|
413 |
ticket.setUpdateTimestamp(LocalDateTime.now());
|
|
|
414 |
ticket.setL2EscalationTimestamp(ticket.getUpdateTimestamp().plusDays(2));
|
|
|
415 |
ticket.setL3EscalationTimestamp(ticket.getL2EscalationTimestamp().plusDays(2));
|
|
|
416 |
ticket.setLastEscalationTimestamp(ticket.getL3EscalationTimestamp().plusDays(2));
|
|
|
417 |
int l3Auth = this.getAuthUserId(categoryId, EscalationType.L3, ticket.getFofoId());
|
| 25505 |
amit.gupta |
418 |
int l2Auth = this.getAuthUserId(categoryId, EscalationType.L2, ticket.getFofoId());
|
| 24500 |
govind |
419 |
int l1Auth = this.getAuthUserId(categoryId, EscalationType.L1, ticket.getFofoId());
|
|
|
420 |
LOGGER.info(l1Auth + "-" + l2Auth + "-" + l3Auth);
|
|
|
421 |
if (l1Auth == 0) {
|
|
|
422 |
if (l2Auth == 0) {
|
|
|
423 |
this.setAssignment(ticket, ticketAssigned);
|
|
|
424 |
} else {
|
|
|
425 |
ticketAssigned.setAssineeId(l2Auth);
|
| 24569 |
govind |
426 |
ticket.setL1AuthUser(0);
|
| 24536 |
govind |
427 |
ticket.setL2AuthUser(l2Auth);
|
| 24500 |
govind |
428 |
}
|
|
|
429 |
} else {
|
|
|
430 |
ticketAssigned.setAssineeId(l1Auth);
|
|
|
431 |
ticket.setL1AuthUser(l1Auth);
|
|
|
432 |
ticket.setL2AuthUser(l2Auth);
|
|
|
433 |
}
|
|
|
434 |
ticket.setL3AuthUser(l3Auth);
|
|
|
435 |
ticketRepository.persist(ticket);
|
|
|
436 |
ticketAssigned.setTicketId(ticket.getId());
|
|
|
437 |
ticketAssignedRepository.persist(ticketAssigned);
|
|
|
438 |
AuthUser authUser = authRepository.selectById(ticketAssigned.getAssineeId());
|
| 24569 |
govind |
439 |
this.sendAssignedTicketMail(authUser, ticket);
|
|
|
440 |
}
|
|
|
441 |
|
|
|
442 |
@Override
|
| 24699 |
govind |
443 |
public void sendAssignedTicketMail(AuthUser authUser, Ticket ticket) throws ProfitMandiBusinessException {
|
| 24500 |
govind |
444 |
try {
|
|
|
445 |
Utils.sendMailWithAttachments(mailSender, authUser.getEmailId(), null, ASSINMENT_SUBJECT,
|
|
|
446 |
String.format(ASSIGNED_TICKET, authUser.getFirstName(),
|
| 24699 |
govind |
447 |
retailerService.getFofoRetailer(ticket.getFofoId()).getBusinessName(), ticket.getId()),
|
| 24500 |
govind |
448 |
null);
|
|
|
449 |
} catch (Exception e) {
|
|
|
450 |
throw new ProfitMandiBusinessException("Ticket Assingment", authUser.getEmailId(),
|
|
|
451 |
"Could not send ticket assignment mail");
|
|
|
452 |
}
|
|
|
453 |
}
|
| 25570 |
tejbeer |
454 |
|
|
|
455 |
@Override
|
|
|
456 |
public Map<Integer, List<CustomRetailer>> getPositionCustomRetailerMap(List<Position> positions) {
|
|
|
457 |
Map<Integer, List<CustomRetailer>> positionRetailerMap = new HashMap<>();
|
|
|
458 |
for (Position position : positions) {
|
|
|
459 |
List<Integer> fofoIds = partnersPositionRepository.selectByPositionId(position.getId()).stream()
|
|
|
460 |
.map(x -> x.getFofoId()).collect(Collectors.toList());
|
|
|
461 |
|
| 26992 |
amit.gupta |
462 |
LOGGER.info("fofoIds - {}", fofoIds);
|
| 25570 |
tejbeer |
463 |
if (!fofoIds.isEmpty()) {
|
|
|
464 |
if (fofoIds.contains(0)) {
|
|
|
465 |
fofoIds = partnerRegionRepository.selectByRegionId(position.getRegionId()).stream()
|
|
|
466 |
.map(x -> x.getFofoId()).collect(Collectors.toList());
|
|
|
467 |
if (fofoIds.contains(0)) {
|
|
|
468 |
fofoIds = fofoStoreRepository.selectAll().stream().map(x -> x.getId())
|
|
|
469 |
.collect(Collectors.toList());
|
|
|
470 |
}
|
|
|
471 |
|
|
|
472 |
}
|
| 26991 |
amit.gupta |
473 |
LOGGER.info("fofoIds - {}", fofoIds);
|
| 25570 |
tejbeer |
474 |
positionRetailerMap.put(position.getId(),
|
|
|
475 |
new ArrayList<CustomRetailer>(retailerService.getFofoRetailers(fofoIds).values()));
|
|
|
476 |
|
|
|
477 |
}
|
|
|
478 |
}
|
|
|
479 |
return positionRetailerMap;
|
|
|
480 |
}
|
|
|
481 |
|
|
|
482 |
@Override
|
|
|
483 |
public Map<Integer, List<CustomRetailer>> getpositionIdAndpartnerRegionMap(List<Position> positions) {
|
|
|
484 |
Map<Integer, List<CustomRetailer>> positionIdAndpartnerRegionMap = new HashedMap<>();
|
|
|
485 |
for (Position position : positions) {
|
|
|
486 |
List<Integer> fofoIds = partnerRegionRepository.selectByRegionId(position.getRegionId()).stream()
|
|
|
487 |
.map(x -> x.getFofoId()).collect(Collectors.toList());
|
|
|
488 |
|
|
|
489 |
if (!fofoIds.isEmpty()) {
|
|
|
490 |
if (fofoIds.contains(0)) {
|
|
|
491 |
fofoIds = fofoStoreRepository.selectAll().stream().map(x -> x.getId()).collect(Collectors.toList());
|
|
|
492 |
|
|
|
493 |
}
|
|
|
494 |
|
|
|
495 |
Map<Integer, CustomRetailer> fofoRetailers = retailerService.getFofoRetailers(fofoIds);
|
|
|
496 |
positionIdAndpartnerRegionMap.put(position.getRegionId(),
|
|
|
497 |
new ArrayList<CustomRetailer>(fofoRetailers.values()));
|
|
|
498 |
}
|
|
|
499 |
|
|
|
500 |
}
|
|
|
501 |
|
|
|
502 |
return positionIdAndpartnerRegionMap;
|
|
|
503 |
}
|
| 25597 |
amit.gupta |
504 |
|
|
|
505 |
@Override
|
| 25726 |
amit.gupta |
506 |
@Cacheable(value = "authUserEmailMapping", cacheManager = "thirtyMinsTimeOutCacheManager")
|
| 25597 |
amit.gupta |
507 |
public Map<String, Set<String>> getAuthUserPartnerEmailMapping() {
|
|
|
508 |
Map<String, Set<String>> storeGuyMap = new HashMap<>();
|
|
|
509 |
Set<Integer> activeFofoIds = fofoStoreRepository.selectActiveStores().stream().map(x -> x.getId())
|
|
|
510 |
.collect(Collectors.toSet());
|
|
|
511 |
List<Position> categoryPositions = positionRepository
|
|
|
512 |
.selectPositionByCategoryId(ProfitMandiConstants.TICKET_CATEGORY_SALES);
|
|
|
513 |
Map<Integer, Position> positionsMap = categoryPositions.stream()
|
|
|
514 |
.collect(Collectors.toMap(x -> x.getId(), x -> x));
|
|
|
515 |
|
| 25721 |
tejbeer |
516 |
Map<Integer, List<CustomRetailer>> positonPartnerMap = this.getPositionCustomRetailerMap(categoryPositions);
|
| 25597 |
amit.gupta |
517 |
for (Map.Entry<Integer, List<CustomRetailer>> positionPartnerEntry : positonPartnerMap.entrySet()) {
|
|
|
518 |
int authUserId = positionsMap.get(positionPartnerEntry.getKey()).getAuthUserId();
|
|
|
519 |
Set<String> partnerEmails = positionPartnerEntry.getValue().stream()
|
|
|
520 |
.filter(x -> activeFofoIds.contains(x.getPartnerId())).map(x -> x.getEmail())
|
|
|
521 |
.collect(Collectors.toSet());
|
|
|
522 |
AuthUser authUser = authRepository.selectById(authUserId);
|
|
|
523 |
if (authUser.isActive()) {
|
| 26298 |
tejbeer |
524 |
if (!storeGuyMap.containsKey(authUser.getEmailId())) {
|
| 26111 |
amit.gupta |
525 |
storeGuyMap.put(authUser.getEmailId(), partnerEmails);
|
|
|
526 |
} else {
|
|
|
527 |
storeGuyMap.get(authUser.getEmailId()).addAll(partnerEmails);
|
|
|
528 |
}
|
| 25597 |
amit.gupta |
529 |
}
|
|
|
530 |
}
|
|
|
531 |
return storeGuyMap;
|
|
|
532 |
}
|
| 25721 |
tejbeer |
533 |
|
|
|
534 |
@Override
|
| 25777 |
amit.gupta |
535 |
@Cacheable(value = "authUserEmailPartnerIdMapping", cacheManager = "thirtyMinsTimeOutCacheManager")
|
| 25721 |
tejbeer |
536 |
public Map<String, Set<Integer>> getAuthUserPartnerIdMapping() {
|
|
|
537 |
Map<String, Set<Integer>> storeGuyMap = new HashMap<>();
|
| 25777 |
amit.gupta |
538 |
Set<Integer> activeFofoIds = fofoStoreRepository.selectActiveStores().stream().map(x -> x.getId())
|
|
|
539 |
.collect(Collectors.toSet());
|
| 25721 |
tejbeer |
540 |
List<Position> categoryPositions = positionRepository
|
|
|
541 |
.selectPositionByCategoryId(ProfitMandiConstants.TICKET_CATEGORY_SALES);
|
|
|
542 |
Map<Integer, Position> positionsMap = categoryPositions.stream()
|
|
|
543 |
.collect(Collectors.toMap(x -> x.getId(), x -> x));
|
|
|
544 |
|
|
|
545 |
Map<Integer, List<CustomRetailer>> positonPartnerMap = this.getPositionCustomRetailerMap(categoryPositions);
|
|
|
546 |
for (Map.Entry<Integer, List<CustomRetailer>> positionPartnerEntry : positonPartnerMap.entrySet()) {
|
|
|
547 |
int authUserId = positionsMap.get(positionPartnerEntry.getKey()).getAuthUserId();
|
| 25777 |
amit.gupta |
548 |
Set<Integer> partnerEmails = positionPartnerEntry.getValue().stream()
|
|
|
549 |
.filter(x -> activeFofoIds.contains(x.getPartnerId())).map(x -> x.getPartnerId())
|
| 25721 |
tejbeer |
550 |
.collect(Collectors.toSet());
|
|
|
551 |
AuthUser authUser = authRepository.selectById(authUserId);
|
|
|
552 |
if (authUser.isActive()) {
|
| 26298 |
tejbeer |
553 |
if (!storeGuyMap.containsKey(authUser.getEmailId())) {
|
| 26111 |
amit.gupta |
554 |
storeGuyMap.put(authUser.getEmailId(), partnerEmails);
|
|
|
555 |
} else {
|
|
|
556 |
storeGuyMap.get(authUser.getEmailId()).addAll(partnerEmails);
|
|
|
557 |
}
|
| 25721 |
tejbeer |
558 |
}
|
|
|
559 |
}
|
|
|
560 |
return storeGuyMap;
|
|
|
561 |
}
|
|
|
562 |
|
|
|
563 |
@Override
|
|
|
564 |
public List<String> getAuthUserByPartnerId(int fofoId) {
|
|
|
565 |
|
|
|
566 |
List<String> emails = new ArrayList<>();
|
|
|
567 |
List<Integer> regionIds = partnerRegionRepository.selectByfofoId(fofoId).stream().map(x -> x.getRegionId())
|
|
|
568 |
.collect(Collectors.toList());
|
|
|
569 |
|
|
|
570 |
regionIds.add(5);// All partners Id;
|
|
|
571 |
List<Integer> fofoIds = new ArrayList<>();
|
|
|
572 |
fofoIds.add(fofoId);
|
|
|
573 |
fofoIds.add(0);
|
| 25799 |
tejbeer |
574 |
|
|
|
575 |
LOGGER.info("fofoIds" + fofoIds);
|
| 25721 |
tejbeer |
576 |
List<Integer> partnerPositionIds = partnersPositionRepository.selectByRegionIdAndPartnerId(regionIds, fofoIds)
|
|
|
577 |
.stream().map(x -> x.getPositionId()).collect(Collectors.toList());
|
|
|
578 |
|
| 25799 |
tejbeer |
579 |
LOGGER.info("partnerPositionIds" + partnerPositionIds);
|
|
|
580 |
|
| 25721 |
tejbeer |
581 |
for (Integer partnerPostionId : partnerPositionIds) {
|
| 25799 |
tejbeer |
582 |
Position position = positionRepository.selectByIdAndCategoryId(partnerPostionId,
|
|
|
583 |
ProfitMandiConstants.TICKET_CATEGORY_SALES);
|
|
|
584 |
LOGGER.info("position" + position);
|
|
|
585 |
if (position != null) {
|
| 25721 |
tejbeer |
586 |
|
| 25799 |
tejbeer |
587 |
AuthUser authUser = authRepository.selectById(position.getAuthUserId());
|
|
|
588 |
LOGGER.info("authUser" + authUser);
|
|
|
589 |
emails.add(authUser.getEmailId());
|
|
|
590 |
}
|
| 25721 |
tejbeer |
591 |
}
|
|
|
592 |
|
|
|
593 |
return emails;
|
|
|
594 |
}
|
| 26298 |
tejbeer |
595 |
|
|
|
596 |
@Override
|
| 26978 |
tejbeer |
597 |
public Map<EscalationType, String> getAuthUserAndEsclationTypeByPartnerId(int fofoId) {
|
|
|
598 |
|
|
|
599 |
List<String> emails = new ArrayList<>();
|
|
|
600 |
Map<EscalationType, String> emailEsclationTypeMap = new HashMap<>();
|
|
|
601 |
List<Integer> regionIds = partnerRegionRepository.selectByfofoId(fofoId).stream().map(x -> x.getRegionId())
|
|
|
602 |
.collect(Collectors.toList());
|
|
|
603 |
|
|
|
604 |
regionIds.add(5);// All partners Id;
|
|
|
605 |
List<Integer> fofoIds = new ArrayList<>();
|
|
|
606 |
fofoIds.add(fofoId);
|
|
|
607 |
fofoIds.add(0);
|
|
|
608 |
|
|
|
609 |
LOGGER.info("fofoIds" + fofoIds);
|
|
|
610 |
List<Integer> partnerPositionIds = partnersPositionRepository.selectByRegionIdAndPartnerId(regionIds, fofoIds)
|
|
|
611 |
.stream().map(x -> x.getPositionId()).collect(Collectors.toList());
|
|
|
612 |
|
|
|
613 |
LOGGER.info("partnerPositionIds" + partnerPositionIds);
|
|
|
614 |
|
|
|
615 |
for (Integer partnerPostionId : partnerPositionIds) {
|
|
|
616 |
Position position = positionRepository.selectByIdAndCategoryId(partnerPostionId,
|
|
|
617 |
ProfitMandiConstants.TICKET_CATEGORY_SALES);
|
|
|
618 |
LOGGER.info("position" + position);
|
|
|
619 |
if (position != null) {
|
|
|
620 |
|
|
|
621 |
AuthUser authUser = authRepository.selectById(position.getAuthUserId());
|
|
|
622 |
LOGGER.info("authUser" + authUser);
|
|
|
623 |
|
|
|
624 |
emailEsclationTypeMap.put(position.getEscalationType(), authUser.getEmailId());
|
|
|
625 |
}
|
|
|
626 |
}
|
|
|
627 |
|
|
|
628 |
LOGGER.info("emailEsclationTypeMap" + emailEsclationTypeMap);
|
|
|
629 |
|
|
|
630 |
return emailEsclationTypeMap;
|
|
|
631 |
}
|
|
|
632 |
|
|
|
633 |
@Override
|
| 26298 |
tejbeer |
634 |
@Cacheable(value = "authUserIdPartnerIdMapping", cacheManager = "thirtyMinsTimeOutCacheManager")
|
|
|
635 |
public Map<Integer, List<Integer>> getAuthUserIdPartnerIdMapping() {
|
|
|
636 |
Map<Integer, List<Integer>> storeGuyMap = new HashMap<>();
|
|
|
637 |
Set<Integer> activeFofoIds = fofoStoreRepository.selectActiveStores().stream().map(x -> x.getId())
|
|
|
638 |
.collect(Collectors.toSet());
|
|
|
639 |
List<Position> categoryPositions = positionRepository
|
|
|
640 |
.selectPositionByCategoryId(ProfitMandiConstants.TICKET_CATEGORY_SALES);
|
|
|
641 |
Map<Integer, Position> positionsMap = categoryPositions.stream()
|
|
|
642 |
.collect(Collectors.toMap(x -> x.getId(), x -> x));
|
|
|
643 |
|
|
|
644 |
Map<Integer, List<CustomRetailer>> positonPartnerMap = this.getPositionCustomRetailerMap(categoryPositions);
|
|
|
645 |
for (Map.Entry<Integer, List<CustomRetailer>> positionPartnerEntry : positonPartnerMap.entrySet()) {
|
|
|
646 |
int authUserId = positionsMap.get(positionPartnerEntry.getKey()).getAuthUserId();
|
| 26991 |
amit.gupta |
647 |
List<Integer> partnerIds = positionPartnerEntry.getValue().stream()
|
| 26298 |
tejbeer |
648 |
.filter(x -> activeFofoIds.contains(x.getPartnerId())).map(x -> x.getPartnerId())
|
|
|
649 |
.collect(Collectors.toList());
|
|
|
650 |
AuthUser authUser = authRepository.selectById(authUserId);
|
|
|
651 |
if (authUser.isActive()) {
|
| 26960 |
amit.gupta |
652 |
if (!storeGuyMap.containsKey(authUserId)) {
|
| 26991 |
amit.gupta |
653 |
storeGuyMap.put(authUserId, partnerIds);
|
| 26298 |
tejbeer |
654 |
} else {
|
| 26991 |
amit.gupta |
655 |
storeGuyMap.get(authUserId).addAll(partnerIds);
|
| 26298 |
tejbeer |
656 |
}
|
|
|
657 |
}
|
|
|
658 |
}
|
|
|
659 |
return storeGuyMap;
|
|
|
660 |
}
|
|
|
661 |
|
|
|
662 |
@Override
|
|
|
663 |
@Cacheable(value = "L1L2Mapping", cacheManager = "thirtyMinsTimeOutCacheManager")
|
| 26460 |
amit.gupta |
664 |
public Map<Integer, List<Integer>> getL2L1Mapping() {
|
| 26448 |
amit.gupta |
665 |
List<Position> l1SalesPositions = positionRepository.selectPositionbyCategoryIdAndEscalationType(
|
|
|
666 |
ProfitMandiConstants.TICKET_CATEGORY_SALES, EscalationType.L1);
|
|
|
667 |
List<Position> l2SalesPositions = positionRepository.selectPositionbyCategoryIdAndEscalationType(
|
|
|
668 |
ProfitMandiConstants.TICKET_CATEGORY_SALES, EscalationType.L2);
|
| 26298 |
tejbeer |
669 |
|
| 26448 |
amit.gupta |
670 |
LOGGER.info("position" + l1SalesPositions);
|
|
|
671 |
Map<Integer, List<Integer>> authUserPartnerListMap = this.getAuthUserIdPartnerIdMapping();
|
|
|
672 |
LOGGER.info("map" + authUserPartnerListMap);
|
| 26298 |
tejbeer |
673 |
|
| 26448 |
amit.gupta |
674 |
Map<Integer, List<Integer>> l2l1ListMap = new HashMap<>();
|
| 26298 |
tejbeer |
675 |
|
| 26448 |
amit.gupta |
676 |
for (Position l2SalePosition : l2SalesPositions) {
|
|
|
677 |
int l2AuthUserId = l2SalePosition.getAuthUserId();
|
|
|
678 |
if (authUserPartnerListMap.containsKey(l2SalePosition.getAuthUserId())) {
|
|
|
679 |
List<Integer> mappedL1AuthUsers = new ArrayList<>();
|
|
|
680 |
l2l1ListMap.put(l2AuthUserId, mappedL1AuthUsers);
|
|
|
681 |
List<Integer> l2FofoIds = authUserPartnerListMap.get(l2AuthUserId);
|
|
|
682 |
for (Position l1SalePosition : l1SalesPositions) {
|
|
|
683 |
int l1AuthUserId = l1SalePosition.getAuthUserId();
|
|
|
684 |
if (authUserPartnerListMap.containsKey(l1AuthUserId)) {
|
|
|
685 |
List<Integer> l1FofoIds = authUserPartnerListMap.get(l1SalePosition.getAuthUserId());
|
|
|
686 |
if (l2FofoIds.containsAll(l1FofoIds)) {
|
|
|
687 |
mappedL1AuthUsers.add(l1AuthUserId);
|
|
|
688 |
}
|
| 26298 |
tejbeer |
689 |
|
| 26448 |
amit.gupta |
690 |
}
|
| 26298 |
tejbeer |
691 |
|
|
|
692 |
}
|
|
|
693 |
}
|
|
|
694 |
|
|
|
695 |
}
|
|
|
696 |
|
| 26448 |
amit.gupta |
697 |
return l2l1ListMap;
|
| 26298 |
tejbeer |
698 |
}
|
| 26448 |
amit.gupta |
699 |
|
| 24383 |
amit.gupta |
700 |
}
|