Subversion Repositories SmartDukaan

Rev

Rev 37351 | Rev 37731 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 37351 Rev 37357
Line 1339... Line 1339...
1339
        return authRepository.selectByIds(authUserIds);
1339
        return authRepository.selectByIds(authUserIds);
1340
 
1340
 
1341
    }
1341
    }
1342
 
1342
 
1343
    @Override
1343
    @Override
-
 
1344
    public List<AuthUser> getAuthUsersByPartnerIdAndCategory(int fofoId, int categoryId, EscalationType... escalationTypes) throws ProfitMandiBusinessException {
-
 
1345
        List<Integer> regionIds = partnerRegionRepository.selectByfofoId(fofoId).stream().map(x -> x.getRegionId()).collect(Collectors.toList());
-
 
1346
        regionIds.add(ALL_PARTNERS_REGION);
-
 
1347
 
-
 
1348
        List<Integer> partnerPositionIds = partnerPositionRepository.selectByRegionIdAndPartnerId(regionIds, Arrays.asList(fofoId, 0))
-
 
1349
                .stream().map(x -> x.getPositionId()).distinct().collect(Collectors.toList());
-
 
1350
        if (partnerPositionIds.isEmpty()) {
-
 
1351
            return new ArrayList<>();
-
 
1352
        }
-
 
1353
 
-
 
1354
        List<EscalationType> escalations = (escalationTypes == null || escalationTypes.length == 0)
-
 
1355
                ? EscalationType.escalations : Arrays.asList(escalationTypes);
-
 
1356
 
-
 
1357
        List<Integer> authUserIds = positionRepository.selectByIds(partnerPositionIds).stream()
-
 
1358
                .filter(x -> x.getCategoryId() == categoryId)
-
 
1359
                .filter(x -> escalations.contains(x.getEscalationType()))
-
 
1360
                .map(x -> x.getAuthUserId())
-
 
1361
                .filter(x -> x > 0)
-
 
1362
                .distinct().collect(Collectors.toList());
-
 
1363
        LOGGER.info("fofoId {}, categoryId {}, escalations {}, authUserIds {}", fofoId, categoryId, escalations, authUserIds);
-
 
1364
        if (authUserIds.isEmpty()) {
-
 
1365
            return new ArrayList<>();
-
 
1366
        }
-
 
1367
 
-
 
1368
        return authRepository.selectByIds(authUserIds).stream()
-
 
1369
                .filter(x -> Boolean.TRUE.equals(x.getActive()))
-
 
1370
                .collect(Collectors.toList());
-
 
1371
    }
-
 
1372
 
-
 
1373
    @Override
1344
    public List<AuthUser> getAuthUserIds(int categoryId, List<EscalationType> escalationType) {
1374
    public List<AuthUser> getAuthUserIds(int categoryId, List<EscalationType> escalationType) {
1345
 
1375
 
1346
        List<Position> positions = positionRepository.selectPositionbyCategoryIdAndEscalationTypes(categoryId, escalationType);
1376
        List<Position> positions = positionRepository.selectPositionbyCategoryIdAndEscalationTypes(categoryId, escalationType);
1347
        List<Integer> authIds = positions.stream().map(x -> x.getAuthUserId()).distinct().collect(Collectors.toList());
1377
        List<Integer> authIds = positions.stream().map(x -> x.getAuthUserId()).distinct().collect(Collectors.toList());
1348
 
1378