| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.dao.repository.cs;
|
1 |
package com.spice.profitmandi.dao.repository.cs;
|
| 2 |
|
2 |
|
| 3 |
import java.time.LocalDateTime;
|
- |
|
| 4 |
import java.util.ArrayList;
|
- |
|
| 5 |
import java.util.Arrays;
|
- |
|
| 6 |
import java.util.HashMap;
|
- |
|
| 7 |
import java.util.HashSet;
|
- |
|
| 8 |
import java.util.LinkedHashSet;
|
- |
|
| 9 |
import java.util.List;
|
- |
|
| 10 |
import java.util.Map;
|
- |
|
| 11 |
import java.util.Set;
|
- |
|
| 12 |
import java.util.stream.Collectors;
|
- |
|
| 13 |
|
- |
|
| 14 |
import org.apache.commons.collections4.map.HashedMap;
|
- |
|
| 15 |
import org.apache.commons.lang.RandomStringUtils;
|
- |
|
| 16 |
import org.apache.commons.lang.StringUtils;
|
- |
|
| 17 |
import org.apache.logging.log4j.LogManager;
|
- |
|
| 18 |
import org.apache.logging.log4j.Logger;
|
- |
|
| 19 |
import org.springframework.beans.factory.annotation.Autowired;
|
- |
|
| 20 |
import org.springframework.cache.annotation.Cacheable;
|
- |
|
| 21 |
import org.springframework.mail.javamail.JavaMailSender;
|
- |
|
| 22 |
import org.springframework.stereotype.Component;
|
- |
|
| 23 |
|
- |
|
| 24 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
3 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 25 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
4 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 26 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
5 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 27 |
import com.spice.profitmandi.common.util.Utils;
|
6 |
import com.spice.profitmandi.common.util.Utils;
|
| 28 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
7 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 29 |
import com.spice.profitmandi.dao.entity.cs.Activity;
|
- |
|
| 30 |
import com.spice.profitmandi.dao.entity.cs.PartnerRegion;
|
- |
|
| 31 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
- |
|
| 32 |
import com.spice.profitmandi.dao.entity.cs.Region;
|
8 |
import com.spice.profitmandi.dao.entity.cs.*;
|
| 33 |
import com.spice.profitmandi.dao.entity.cs.Ticket;
|
- |
|
| 34 |
import com.spice.profitmandi.dao.entity.cs.TicketAssigned;
|
- |
|
| 35 |
import com.spice.profitmandi.dao.entity.cs.TicketCategory;
|
- |
|
| 36 |
import com.spice.profitmandi.dao.entity.cs.TicketSubCategory;
|
- |
|
| 37 |
import com.spice.profitmandi.dao.entity.fofo.ActivityType;
|
9 |
import com.spice.profitmandi.dao.entity.fofo.ActivityType;
|
| 38 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
10 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 39 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
11 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| 40 |
import com.spice.profitmandi.dao.model.FofoReportingModel;
|
12 |
import com.spice.profitmandi.dao.model.FofoReportingModel;
|
| 41 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
13 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 42 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
14 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 43 |
import com.spice.profitmandi.service.user.RetailerService;
|
15 |
import com.spice.profitmandi.service.user.RetailerService;
|
| - |
|
16 |
import org.apache.commons.collections4.map.HashedMap;
|
| - |
|
17 |
import org.apache.commons.lang.RandomStringUtils;
|
| - |
|
18 |
import org.apache.commons.lang.StringUtils;
|
| - |
|
19 |
import org.apache.logging.log4j.LogManager;
|
| - |
|
20 |
import org.apache.logging.log4j.Logger;
|
| - |
|
21 |
import org.springframework.beans.factory.annotation.Autowired;
|
| - |
|
22 |
import org.springframework.cache.annotation.Cacheable;
|
| - |
|
23 |
import org.springframework.mail.javamail.JavaMailSender;
|
| - |
|
24 |
import org.springframework.stereotype.Component;
|
| - |
|
25 |
|
| - |
|
26 |
import java.time.LocalDateTime;
|
| - |
|
27 |
import java.util.*;
|
| - |
|
28 |
import java.util.stream.Collectors;
|
| 44 |
|
29 |
|
| 45 |
@Component
|
30 |
@Component
|
| 46 |
public class CsServiceImpl implements CsService {
|
31 |
public class CsServiceImpl implements CsService {
|
| 47 |
|
32 |
|
| 48 |
private static final int ALL_PARTNERS_REGION = 5;
|
33 |
private static final int ALL_PARTNERS_REGION = 5;
|
| Line 430... |
Line 415... |
| 430 |
}
|
415 |
}
|
| 431 |
}
|
416 |
}
|
| 432 |
|
417 |
|
| 433 |
@Override
|
418 |
@Override
|
| 434 |
public Map<Integer, List<CustomRetailer>> getPositionCustomRetailerMap(List<Position> positions) {
|
419 |
public Map<Integer, List<CustomRetailer>> getPositionCustomRetailerMap(List<Position> positions) {
|
| - |
|
420 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
|
| 435 |
Map<Integer, List<CustomRetailer>> positionRetailerMap = new HashMap<>();
|
421 |
Map<Integer, List<CustomRetailer>> positionRetailerMap = new HashMap<>();
|
| 436 |
for (Position position : positions) {
|
422 |
for (Position position : positions) {
|
| 437 |
List<Integer> fofoIds = partnersPositionRepository.selectByPositionId(position.getId()).stream()
|
423 |
List<Integer> fofoIds = partnersPositionRepository.selectByPositionId(position.getId()).stream()
|
| 438 |
.map(x -> x.getFofoId()).collect(Collectors.toList());
|
424 |
.map(x -> x.getFofoId()).collect(Collectors.toList());
|
| 439 |
|
425 |
|
| Line 447... |
Line 433... |
| 447 |
.collect(Collectors.toList());
|
433 |
.collect(Collectors.toList());
|
| 448 |
}
|
434 |
}
|
| 449 |
|
435 |
|
| 450 |
}
|
436 |
}
|
| 451 |
LOGGER.info("fofoIds - {}", fofoIds);
|
437 |
LOGGER.info("fofoIds - {}", fofoIds);
|
| 452 |
positionRetailerMap.put(position.getId(),
|
- |
|
| 453 |
new ArrayList<CustomRetailer>(retailerService.getFofoRetailers(fofoIds).values()));
|
438 |
positionRetailerMap.put(position.getId(), fofoIds.stream().map(x -> customRetailerMap.get(x)).collect(Collectors.toList()));
|
| 454 |
|
439 |
|
| 455 |
}
|
440 |
}
|
| 456 |
}
|
441 |
}
|
| 457 |
return positionRetailerMap;
|
442 |
return positionRetailerMap;
|
| 458 |
}
|
443 |
}
|