| Line 441... |
Line 441... |
| 441 |
}
|
441 |
}
|
| 442 |
return authUserId;
|
442 |
return authUserId;
|
| 443 |
|
443 |
|
| 444 |
}
|
444 |
}
|
| 445 |
|
445 |
|
| - |
|
446 |
@Override
|
| - |
|
447 |
public int getAuthUserIdWithoutTicketAssignee(int categoryId, EscalationType escalationType, int fofoId) throws ProfitMandiBusinessException {
|
| - |
|
448 |
int authUserId = 0;
|
| - |
|
449 |
List<Position> positions = positionRepository.selectPositionbyCategoryIdAndEscalationType(categoryId, escalationType);
|
| - |
|
450 |
List<Integer> regionIds = partnerRegionRepository.selectByfofoId(fofoId).stream().map(x -> x.getRegionId()).collect(Collectors.toList());
|
| - |
|
451 |
// Add all Partner regions id
|
| - |
|
452 |
regionIds.add(ALL_PARTNERS_REGION);
|
| - |
|
453 |
LOGGER.info("Escalation Type {}, Region Ids {}", escalationType, regionIds);
|
| - |
|
454 |
List<Integer> partnerPositionsIds = partnerPositionRepository.selectByRegionIdAndPartnerId(regionIds, Arrays.asList(0, fofoId)).stream().map(x -> x.getPositionId()).collect(Collectors.toList());
|
| - |
|
455 |
|
| - |
|
456 |
List<Position> positionAssignee = positions.stream().filter(x -> partnerPositionsIds.contains(x.getId())).collect(Collectors.toList());
|
| - |
|
457 |
LOGGER.info("User List List {}", positions.stream().map(x -> x.getAuthUserId()).collect(Collectors.toList()));
|
| - |
|
458 |
LOGGER.info("positionAssignee List {}", positionAssignee);
|
| - |
|
459 |
if (positionAssignee.size() > 0) {
|
| - |
|
460 |
|
| - |
|
461 |
List<AuthUser> authUsers = authRepository.selectAllAuthUserByIds(
|
| - |
|
462 |
positionAssignee.stream().map(x -> x.getAuthUserId()).collect(Collectors.toList()));
|
| - |
|
463 |
authUsers = authUsers.stream().filter(x -> x.isActive()).collect(Collectors.toList());
|
| - |
|
464 |
LOGGER.info("Auth User List {}", authUsers);
|
| - |
|
465 |
if (authUsers.size() > 0) {
|
| - |
|
466 |
authUserId = authUsers.get(0).getId();
|
| - |
|
467 |
/*
|
| - |
|
468 |
* Random rand = new Random(); authUserId =
|
| - |
|
469 |
* authUsers.get(rand.nextInt(authUsers.size())).getId();
|
| - |
|
470 |
*/
|
| - |
|
471 |
}
|
| - |
|
472 |
}
|
| - |
|
473 |
return authUserId;
|
| - |
|
474 |
|
| - |
|
475 |
}
|
| - |
|
476 |
|
| 446 |
|
477 |
|
| 447 |
@Override
|
478 |
@Override
|
| 448 |
public void addActivity(Ticket ticket, Activity activity) {
|
479 |
public void addActivity(Ticket ticket, Activity activity) {
|
| 449 |
activity.setTicketId(ticket.getId());
|
480 |
activity.setTicketId(ticket.getId());
|
| 450 |
ticket.setLastActivity(activity.getType());
|
481 |
ticket.setLastActivity(activity.getType());
|