Subversion Repositories SmartDukaan

Rev

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

Rev 29605 Rev 30017
Line 1... Line 1...
1
package com.spice.profitmandi.service.user;
1
package com.spice.profitmandi.service.user;
2
 
2
 
3
import java.nio.charset.StandardCharsets;
-
 
4
import java.time.LocalDateTime;
-
 
5
import java.util.ArrayList;
-
 
6
import java.util.HashMap;
-
 
7
import java.util.HashSet;
-
 
8
import java.util.List;
-
 
9
import java.util.Map;
-
 
10
import java.util.Set;
-
 
11
import java.util.function.Function;
-
 
12
import java.util.stream.Collectors;
-
 
13
import java.util.stream.Stream;
-
 
14
 
-
 
15
import org.apache.logging.log4j.LogManager;
-
 
16
import org.apache.logging.log4j.Logger;
-
 
17
import org.springframework.beans.factory.annotation.Autowired;
-
 
18
import org.springframework.beans.factory.annotation.Qualifier;
-
 
19
import org.springframework.cache.annotation.Cacheable;
-
 
20
import org.springframework.stereotype.Component;
-
 
21
 
-
 
22
import com.google.common.hash.Hashing;
3
import com.google.common.hash.Hashing;
23
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
4
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
24
import com.spice.profitmandi.common.model.CustomAddress;
-
 
25
import com.spice.profitmandi.common.model.CustomRetailer;
-
 
26
import com.spice.profitmandi.common.model.CustomShop;
-
 
27
import com.spice.profitmandi.common.model.MapWrapper;
5
import com.spice.profitmandi.common.model.*;
28
import com.spice.profitmandi.common.model.ProfitMandiConstants;
-
 
29
import com.spice.profitmandi.common.model.UpdateRetailerRequest;
-
 
30
import com.spice.profitmandi.common.util.StringUtils;
6
import com.spice.profitmandi.common.util.StringUtils;
31
import com.spice.profitmandi.common.util.Utils;
7
import com.spice.profitmandi.common.util.Utils;
32
import com.spice.profitmandi.dao.entity.dtr.DistrictMaster;
-
 
33
import com.spice.profitmandi.dao.entity.dtr.Retailer;
-
 
34
import com.spice.profitmandi.dao.entity.dtr.RetailerBlockBrands;
-
 
35
import com.spice.profitmandi.dao.entity.dtr.RetailerRegisteredAddress;
-
 
36
import com.spice.profitmandi.dao.entity.dtr.Role;
-
 
37
import com.spice.profitmandi.dao.entity.dtr.Shop;
-
 
38
import com.spice.profitmandi.dao.entity.dtr.ShopAddress;
-
 
39
import com.spice.profitmandi.dao.entity.dtr.User;
8
import com.spice.profitmandi.dao.entity.dtr.User;
40
import com.spice.profitmandi.dao.entity.dtr.UserAccount;
-
 
41
import com.spice.profitmandi.dao.entity.dtr.UserRole;
9
import com.spice.profitmandi.dao.entity.dtr.*;
42
import com.spice.profitmandi.dao.entity.fofo.FofoPartnerPaymentOption;
-
 
43
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
10
import com.spice.profitmandi.dao.entity.fofo.*;
44
import com.spice.profitmandi.dao.entity.fofo.PartnerOnBoardingPanel;
-
 
45
import com.spice.profitmandi.dao.entity.fofo.PartnerVerificationpanel;
-
 
46
import com.spice.profitmandi.dao.entity.fofo.PaymentOption;
-
 
47
import com.spice.profitmandi.dao.entity.inventory.State;
11
import com.spice.profitmandi.dao.entity.inventory.State;
48
import com.spice.profitmandi.dao.entity.user.Address;
-
 
49
import com.spice.profitmandi.dao.entity.user.Cart;
12
import com.spice.profitmandi.dao.entity.user.*;
50
import com.spice.profitmandi.dao.entity.user.Counter;
-
 
51
import com.spice.profitmandi.dao.entity.user.LoginRequestResponseModel;
-
 
52
import com.spice.profitmandi.dao.entity.user.PrivateDealUser;
-
 
53
import com.spice.profitmandi.dao.entity.user.PrivateDealUserAddressMapping;
-
 
54
import com.spice.profitmandi.dao.enumuration.dtr.AccountType;
13
import com.spice.profitmandi.dao.enumuration.dtr.AccountType;
55
import com.spice.profitmandi.dao.enumuration.dtr.RetailerType;
14
import com.spice.profitmandi.dao.enumuration.dtr.RetailerType;
56
import com.spice.profitmandi.dao.enumuration.dtr.RoleType;
15
import com.spice.profitmandi.dao.enumuration.dtr.RoleType;
57
import com.spice.profitmandi.dao.enumuration.fofo.PaymentOptionType;
16
import com.spice.profitmandi.dao.enumuration.fofo.PaymentOptionType;
58
import com.spice.profitmandi.dao.enumuration.transaction.PartnerVerificationApprovalStatus;
17
import com.spice.profitmandi.dao.enumuration.transaction.PartnerVerificationApprovalStatus;
59
import com.spice.profitmandi.dao.repository.dtr.DistrictMasterRepository;
-
 
60
import com.spice.profitmandi.dao.repository.dtr.DocumentRepository;
-
 
61
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
-
 
62
import com.spice.profitmandi.dao.repository.dtr.Mongo;
-
 
63
import com.spice.profitmandi.dao.repository.dtr.PartnerOnBoardingPanelRepository;
-
 
64
import com.spice.profitmandi.dao.repository.dtr.PartnerOnboardingVerificationRepository;
-
 
65
import com.spice.profitmandi.dao.repository.dtr.RetailerBlockBrandsRepository;
-
 
66
import com.spice.profitmandi.dao.repository.dtr.RetailerRegisteredAddressRepository;
-
 
67
import com.spice.profitmandi.dao.repository.dtr.RetailerRepository;
-
 
68
import com.spice.profitmandi.dao.repository.dtr.RoleRepository;
-
 
69
import com.spice.profitmandi.dao.repository.dtr.ShopAddressRepository;
-
 
70
import com.spice.profitmandi.dao.repository.dtr.ShopRepository;
-
 
71
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
-
 
72
import com.spice.profitmandi.dao.repository.dtr.UserRepository;
18
import com.spice.profitmandi.dao.repository.dtr.UserRepository;
73
import com.spice.profitmandi.dao.repository.dtr.UserRoleRepository;
19
import com.spice.profitmandi.dao.repository.dtr.*;
74
import com.spice.profitmandi.dao.repository.fofo.FofoPartnerPaymentOptionRepository;
20
import com.spice.profitmandi.dao.repository.fofo.FofoPartnerPaymentOptionRepository;
75
import com.spice.profitmandi.dao.repository.fofo.PaymentOptionRepository;
21
import com.spice.profitmandi.dao.repository.fofo.PaymentOptionRepository;
76
import com.spice.profitmandi.dao.repository.inventory.StateRepository;
22
import com.spice.profitmandi.dao.repository.inventory.StateRepository;
77
import com.spice.profitmandi.dao.repository.user.AddressRepository;
-
 
78
import com.spice.profitmandi.dao.repository.user.CartRepository;
23
import com.spice.profitmandi.dao.repository.user.*;
79
import com.spice.profitmandi.dao.repository.user.CounterRepository;
-
 
80
import com.spice.profitmandi.dao.repository.user.PrivateDealUserAddressMappingRepository;
-
 
81
import com.spice.profitmandi.dao.repository.user.PrivateDealUserRepository;
-
 
82
import com.spice.profitmandi.service.offers.PartnerCriteria;
24
import com.spice.profitmandi.service.offers.PartnerCriteria;
83
 
-
 
84
import in.shop2020.model.v1.inventory.StateInfo;
25
import in.shop2020.model.v1.inventory.StateInfo;
85
import in.shop2020.model.v1.user.CartStatus;
26
import in.shop2020.model.v1.user.CartStatus;
-
 
27
import org.apache.logging.log4j.LogManager;
-
 
28
import org.apache.logging.log4j.Logger;
-
 
29
import org.springframework.beans.factory.annotation.Autowired;
-
 
30
import org.springframework.beans.factory.annotation.Qualifier;
-
 
31
import org.springframework.cache.annotation.Cacheable;
-
 
32
import org.springframework.stereotype.Component;
-
 
33
 
-
 
34
import java.nio.charset.StandardCharsets;
-
 
35
import java.time.LocalDateTime;
-
 
36
import java.util.*;
-
 
37
import java.util.function.Function;
-
 
38
import java.util.stream.Collectors;
-
 
39
import java.util.stream.Stream;
86
 
40
 
87
@Component
41
@Component
88
public class RetailerServiceImpl implements RetailerService {
42
public class RetailerServiceImpl implements RetailerService {
89
 
43
 
90
	private static final Logger LOGGER = LogManager.getLogger(RetailerServiceImpl.class);
44
	private static final Logger LOGGER = LogManager.getLogger(RetailerServiceImpl.class);
Line 1154... Line 1108...
1154
		List<Integer> storeIds = storeStream.map(x -> x.getId()).collect(Collectors.toList());
1108
		List<Integer> storeIds = storeStream.map(x -> x.getId()).collect(Collectors.toList());
1155
		return this.getFofoRetailers(storeIds);
1109
		return this.getFofoRetailers(storeIds);
1156
	}
1110
	}
1157
 
1111
 
1158
	@Override
1112
	@Override
1159
	@Cacheable(value = "retailerNames", cacheManager = "oneDayCacheManager")
1113
	@Cacheable(value = "allFofoRetailers", cacheManager = "oneDayCacheManager")
1160
	public Map<Integer, CustomRetailer> getAllFofoRetailers() {
1114
	public Map<Integer, CustomRetailer> getAllFofoRetailers() {
1161
		// TODO Auto-generated method stub
1115
		// TODO Auto-generated method stub
1162
		Stream<FofoStore> storeStream = fofoStoreRepository.selectAll().stream();
1116
		Stream<FofoStore> storeStream = fofoStoreRepository.selectAll().stream();
1163
 
1117
 
1164
		List<Integer> storeIds = storeStream.map(x -> x.getId()).collect(Collectors.toList());
1118
		List<Integer> storeIds = storeStream.map(x -> x.getId()).collect(Collectors.toList());