Subversion Repositories SmartDukaan

Rev

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

Rev 29318 Rev 29927
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.logging.log4j.LogManager;
-
 
17
import org.apache.logging.log4j.Logger;
-
 
18
import org.springframework.beans.factory.annotation.Autowired;
-
 
19
import org.springframework.cache.annotation.Cacheable;
-
 
20
import org.springframework.mail.javamail.JavaMailSender;
-
 
21
import org.springframework.stereotype.Component;
-
 
22
 
-
 
23
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
3
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
24
import com.spice.profitmandi.common.model.CustomRetailer;
4
import com.spice.profitmandi.common.model.CustomRetailer;
25
import com.spice.profitmandi.common.model.ProfitMandiConstants;
5
import com.spice.profitmandi.common.model.ProfitMandiConstants;
26
import com.spice.profitmandi.common.util.Utils;
6
import com.spice.profitmandi.common.util.Utils;
27
import com.spice.profitmandi.dao.entity.auth.AuthUser;
7
import com.spice.profitmandi.dao.entity.auth.AuthUser;
28
import com.spice.profitmandi.dao.entity.cs.Activity;
-
 
29
import com.spice.profitmandi.dao.entity.cs.PartnerRegion;
-
 
30
import com.spice.profitmandi.dao.entity.cs.Position;
-
 
31
import com.spice.profitmandi.dao.entity.cs.Region;
8
import com.spice.profitmandi.dao.entity.cs.*;
32
import com.spice.profitmandi.dao.entity.cs.Ticket;
-
 
33
import com.spice.profitmandi.dao.entity.cs.TicketAssigned;
-
 
34
import com.spice.profitmandi.dao.entity.cs.TicketCategory;
-
 
35
import com.spice.profitmandi.dao.entity.cs.TicketSubCategory;
-
 
36
import com.spice.profitmandi.dao.entity.fofo.ActivityType;
9
import com.spice.profitmandi.dao.entity.fofo.ActivityType;
37
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
10
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
38
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
11
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
39
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
12
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
40
import com.spice.profitmandi.service.user.RetailerService;
13
import com.spice.profitmandi.service.user.RetailerService;
-
 
14
import org.apache.commons.collections4.map.HashedMap;
-
 
15
import org.apache.commons.lang.RandomStringUtils;
-
 
16
import org.apache.logging.log4j.LogManager;
-
 
17
import org.apache.logging.log4j.Logger;
-
 
18
import org.springframework.beans.factory.annotation.Autowired;
-
 
19
import org.springframework.cache.annotation.Cacheable;
-
 
20
import org.springframework.mail.javamail.JavaMailSender;
-
 
21
import org.springframework.stereotype.Component;
-
 
22
 
-
 
23
import java.time.LocalDateTime;
-
 
24
import java.util.*;
-
 
25
import java.util.stream.Collectors;
41
 
26
 
42
@Component
27
@Component
43
public class CsServiceImpl implements CsService {
28
public class CsServiceImpl implements CsService {
44
 
29
 
45
	private static final int ALL_PARTNERS_REGION = 5;
30
	private static final int ALL_PARTNERS_REGION = 5;
Line 776... Line 761...
776
		LOGGER.info("authUsers" + authUsers);
761
		LOGGER.info("authUsers" + authUsers);
777
		return authUsers;
762
		return authUsers;
778
	}
763
	}
779
 
764
 
780
	@Override
765
	@Override
781
	public List<AuthUser> getAuthUserBycateggoryId(int categoryId, EscalationType escalationType) {
766
	public List<AuthUser> getAuthUserByCategoryId(int categoryId, EscalationType escalationType) {
782
 
767
 
783
		List<Position> positions = positionRepository.selectPositionbyCategoryIdAndEscalationType(categoryId,
768
		List<Position> positions = positionRepository.selectPositionbyCategoryIdAndEscalationType(categoryId,
784
				escalationType);
769
				escalationType);
785
		List<Integer> authIds = positions.stream().map(x -> x.getAuthUserId()).distinct().collect(Collectors.toList());
770
		List<Integer> authIds = positions.stream().map(x -> x.getAuthUserId()).distinct().collect(Collectors.toList());
786
 
771
 
Line 791... Line 776...
791
		LOGGER.info("authUsers" + authUsers);
776
		LOGGER.info("authUsers" + authUsers);
792
		return authUsers;
777
		return authUsers;
793
	}
778
	}
794
 
779
 
795
	@Override
780
	@Override
-
 
781
	@Cacheable(value = "authUserByCategoryId", cacheManager = "thirtyMinsTimeOutCacheManager")
796
	public List<AuthUser> getAuthUserByCategoryId(int categoryId) {
782
	public List<AuthUser> getAuthUserByCategoryId(int categoryId) {
797
		List<Position> positions = positionRepository.selectPositionByCategoryId(categoryId);
783
		List<Position> positions = positionRepository.selectPositionByCategoryId(categoryId);
798
		List<Integer> authIds = positions.stream().map(x -> x.getAuthUserId()).distinct().collect(Collectors.toList());
784
		List<Integer> authIds = positions.stream().map(x -> x.getAuthUserId()).distinct().collect(Collectors.toList());
799
 
785
 
800
		LOGGER.info("authIds" + authIds);
786
		LOGGER.info("authIds" + authIds);
801
 
787
 
802
		List<AuthUser> authUsers = authRepository.selectAllAuthUserByIds(authIds);
788
		List<AuthUser> authUsers = authRepository.selectAllAuthUserByIds(authIds).stream().filter(x -> x.getActive()).collect(Collectors.toList());
803
 
789
 
804
		LOGGER.info("authUsers" + authUsers);
790
		LOGGER.info("authUsers" + authUsers);
805
		return authUsers;
791
		return authUsers;
806
	}
792
	}
807
 
793