| Line 10... |
Line 10... |
| 10 |
import java.util.Map;
|
10 |
import java.util.Map;
|
| 11 |
import java.util.OptionalInt;
|
11 |
import java.util.OptionalInt;
|
| 12 |
import java.util.Random;
|
12 |
import java.util.Random;
|
| 13 |
import java.util.Set;
|
13 |
import java.util.Set;
|
| 14 |
import java.util.function.IntPredicate;
|
14 |
import java.util.function.IntPredicate;
|
| - |
|
15 |
import java.util.stream.Collector;
|
| 15 |
import java.util.stream.Collectors;
|
16 |
import java.util.stream.Collectors;
|
| 16 |
|
17 |
|
| 17 |
import org.apache.commons.collections4.map.HashedMap;
|
18 |
import org.apache.commons.collections4.map.HashedMap;
|
| 18 |
import org.apache.commons.lang.RandomStringUtils;
|
19 |
import org.apache.commons.lang.RandomStringUtils;
|
| 19 |
import org.apache.logging.log4j.LogManager;
|
20 |
import org.apache.logging.log4j.LogManager;
|
| Line 40... |
Line 41... |
| 40 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
41 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| 41 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
42 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 42 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
43 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 43 |
import com.spice.profitmandi.service.user.RetailerService;
|
44 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 44 |
|
45 |
|
| - |
|
46 |
import in.shop2020.utils.HelperService.authenticateCatalogUser_args;
|
| - |
|
47 |
|
| 45 |
@Component
|
48 |
@Component
|
| 46 |
public class CsServiceImpl implements CsService {
|
49 |
public class CsServiceImpl implements CsService {
|
| 47 |
|
50 |
|
| 48 |
private static final int ALL_PARTNERS_REGION = 5;
|
51 |
private static final int ALL_PARTNERS_REGION = 5;
|
| 49 |
|
52 |
|
| Line 395... |
Line 398... |
| 395 |
regionIdAndRegionMap.put(position.getRegionId(), region);
|
398 |
regionIdAndRegionMap.put(position.getRegionId(), region);
|
| 396 |
}
|
399 |
}
|
| 397 |
return regionIdAndRegionMap;
|
400 |
return regionIdAndRegionMap;
|
| 398 |
}
|
401 |
}
|
| 399 |
|
402 |
|
| 400 |
@Override
|
- |
|
| 401 |
public Map<Integer, List<AuthUser>> getAuthUserList(List<Ticket> tickets, AuthUser authUser) {
|
- |
|
| 402 |
Map<Integer, List<AuthUser>> authUserListMap = new HashMap<>();
|
- |
|
| 403 |
for (Ticket ticket : tickets) {
|
- |
|
| 404 |
if (ticket.getL2AuthUser() == authUser.getId()) {
|
- |
|
| 405 |
List<AuthUser> authUsers = new ArrayList<>();
|
- |
|
| 406 |
authUsers.add(authRepository.selectById(ticket.getL1AuthUser()));
|
- |
|
| 407 |
authUserListMap.put(ticket.getId(), authUsers);
|
- |
|
| 408 |
|
- |
|
| 409 |
} else if (ticket.getL3AuthUser() == authUser.getId()) {
|
- |
|
| 410 |
TicketAssigned ticketAssigned = ticketAssignedRepository
|
- |
|
| 411 |
.selectByAssigneeIdAndTicketId(ticket.getL2AuthUser(), ticket.getId());
|
- |
|
| 412 |
if (ticketAssigned == null) {
|
- |
|
| 413 |
List<AuthUser> authUsers = new ArrayList<>();
|
- |
|
| 414 |
authUsers.add(authRepository.selectById(ticket.getL1AuthUser()));
|
- |
|
| 415 |
authUserListMap.put(ticket.getId(), authUsers);
|
- |
|
| 416 |
} else {
|
- |
|
| 417 |
List<AuthUser> authUsers = new ArrayList<>();
|
- |
|
| 418 |
authUsers.add(authRepository.selectById(ticket.getL1AuthUser()));
|
- |
|
| 419 |
authUsers.add(authRepository.selectById(ticket.getL2AuthUser()));
|
- |
|
| 420 |
authUserListMap.put(ticket.getId(), authUsers);
|
- |
|
| 421 |
}
|
- |
|
| 422 |
} else {
|
- |
|
| 423 |
TicketAssigned ticketAssigned = ticketAssignedRepository
|
- |
|
| 424 |
.selectByAssigneeIdAndTicketId(ticket.getL3AuthUser(), ticket.getId());
|
- |
|
| 425 |
if (ticketAssigned == null) {
|
- |
|
| 426 |
ticketAssigned = ticketAssignedRepository.selectByAssigneeIdAndTicketId(ticket.getL2AuthUser(),
|
- |
|
| 427 |
ticket.getId());
|
- |
|
| 428 |
if (ticketAssigned == null) {
|
- |
|
| 429 |
List<AuthUser> authUsers = new ArrayList<>();
|
- |
|
| 430 |
authUsers.add(authRepository.selectById(ticket.getL1AuthUser()));
|
- |
|
| 431 |
authUserListMap.put(ticket.getId(), authUsers);
|
- |
|
| 432 |
} else {
|
- |
|
| 433 |
List<AuthUser> authUsers = new ArrayList<>();
|
- |
|
| 434 |
authUsers.add(authRepository.selectById(ticket.getL1AuthUser()));
|
- |
|
| 435 |
authUsers.add(authRepository.selectById(ticket.getL2AuthUser()));
|
- |
|
| 436 |
authUserListMap.put(ticket.getId(), authUsers);
|
- |
|
| 437 |
}
|
- |
|
| 438 |
} else {
|
- |
|
| 439 |
List<AuthUser> authUsers = new ArrayList<>();
|
- |
|
| 440 |
authUsers.add(authRepository.selectById(ticket.getL1AuthUser()));
|
- |
|
| 441 |
authUsers.add(authRepository.selectById(ticket.getL2AuthUser()));
|
- |
|
| 442 |
authUsers.add(authRepository.selectById(ticket.getL3AuthUser()));
|
- |
|
| 443 |
authUserListMap.put(ticket.getId(), authUsers);
|
- |
|
| 444 |
|
- |
|
| 445 |
}
|
- |
|
| 446 |
}
|
- |
|
| 447 |
}
|
- |
|
| 448 |
return authUserListMap;
|
- |
|
| 449 |
}
|
- |
|
| 450 |
|
- |
|
| 451 |
private void sendAssignedTicketMail(AuthUser authUserTo, List<AuthUser> authUsersCc, Ticket ticket, boolean isEscalated)
|
403 |
private void sendAssignedTicketMail(AuthUser authUserTo, List<AuthUser> authUsersCc, Ticket ticket, boolean isEscalated)
|
| 452 |
throws ProfitMandiBusinessException {
|
404 |
throws ProfitMandiBusinessException {
|
| 453 |
try {
|
405 |
try {
|
| 454 |
String[] ccTo = authUsersCc.stream().filter(x -> x != null).map(x -> x.getEmailId()).toArray(String[]::new);
|
406 |
String[] ccTo = authUsersCc.stream().filter(x -> x != null).map(x -> x.getEmailId()).toArray(String[]::new);
|
| 455 |
|
407 |
|
| Line 712... |
Line 664... |
| 712 |
}
|
664 |
}
|
| 713 |
|
665 |
|
| 714 |
return l2l1ListMap;
|
666 |
return l2l1ListMap;
|
| 715 |
}
|
667 |
}
|
| 716 |
|
668 |
|
| - |
|
669 |
@Override
|
| - |
|
670 |
public Map<Integer, List<AuthUser>> getAssignedAuthList(List<Ticket> tickets) {
|
| - |
|
671 |
List<TicketAssigned> ticketAssignedList = ticketAssignedRepository.selectByTicketIds(tickets.stream().map(x->x.getId()).collect(Collectors.toList()));
|
| - |
|
672 |
List<Integer> authUserIds = ticketAssignedList.stream().map(x->x.getAssineeId()).distinct().collect(Collectors.toList());
|
| - |
|
673 |
Map<Integer, AuthUser> authUserMap = authRepository.selectAllAuthUserByIds(authUserIds).stream().collect(Collectors.toMap(x->x.getId(), x->x));
|
| - |
|
674 |
return ticketAssignedList.stream().collect(Collectors.groupingBy(x->x.getTicketId(), Collectors.mapping(x->authUserMap.get(x.getAssineeId()), Collectors.toList())));
|
| - |
|
675 |
}
|
| - |
|
676 |
|
| 717 |
}
|
677 |
}
|