Subversion Repositories SmartDukaan

Rev

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

Rev 34942 Rev 35203
Line 5... Line 5...
5
import com.spice.profitmandi.common.enumuration.FofoType;
5
import com.spice.profitmandi.common.enumuration.FofoType;
6
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
6
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
7
import com.spice.profitmandi.common.model.*;
7
import com.spice.profitmandi.common.model.*;
8
import com.spice.profitmandi.common.util.StringUtils;
8
import com.spice.profitmandi.common.util.StringUtils;
9
import com.spice.profitmandi.common.util.Utils;
9
import com.spice.profitmandi.common.util.Utils;
10
import com.spice.profitmandi.dao.entity.dtr.User;
-
 
11
import com.spice.profitmandi.dao.entity.dtr.*;
10
import com.spice.profitmandi.dao.entity.dtr.*;
-
 
11
import com.spice.profitmandi.dao.entity.dtr.User;
12
import com.spice.profitmandi.dao.entity.fofo.*;
12
import com.spice.profitmandi.dao.entity.fofo.*;
13
import com.spice.profitmandi.dao.entity.inventory.State;
13
import com.spice.profitmandi.dao.entity.inventory.State;
14
import com.spice.profitmandi.dao.entity.logistics.AST;
14
import com.spice.profitmandi.dao.entity.logistics.AST;
15
import com.spice.profitmandi.dao.entity.logistics.ASTRepository;
15
import com.spice.profitmandi.dao.entity.logistics.ASTRepository;
16
import com.spice.profitmandi.dao.entity.user.*;
16
import com.spice.profitmandi.dao.entity.user.*;
Line 18... Line 18...
18
import com.spice.profitmandi.dao.enumuration.dtr.RetailerType;
18
import com.spice.profitmandi.dao.enumuration.dtr.RetailerType;
19
import com.spice.profitmandi.dao.enumuration.dtr.RoleType;
19
import com.spice.profitmandi.dao.enumuration.dtr.RoleType;
20
import com.spice.profitmandi.dao.enumuration.fofo.PaymentOptionType;
20
import com.spice.profitmandi.dao.enumuration.fofo.PaymentOptionType;
21
import com.spice.profitmandi.dao.enumuration.transaction.PartnerVerificationApprovalStatus;
21
import com.spice.profitmandi.dao.enumuration.transaction.PartnerVerificationApprovalStatus;
22
import com.spice.profitmandi.dao.model.LastMonthCreditedIncomeModel;
22
import com.spice.profitmandi.dao.model.LastMonthCreditedIncomeModel;
23
import com.spice.profitmandi.dao.repository.dtr.UserRepository;
-
 
24
import com.spice.profitmandi.dao.repository.dtr.*;
23
import com.spice.profitmandi.dao.repository.dtr.*;
-
 
24
import com.spice.profitmandi.dao.repository.dtr.UserRepository;
25
import com.spice.profitmandi.dao.repository.fofo.*;
25
import com.spice.profitmandi.dao.repository.fofo.*;
26
import com.spice.profitmandi.dao.repository.inventory.StateRepository;
26
import com.spice.profitmandi.dao.repository.inventory.StateRepository;
27
import com.spice.profitmandi.dao.repository.user.*;
27
import com.spice.profitmandi.dao.repository.user.*;
28
import com.spice.profitmandi.service.PostOfficeService;
28
import com.spice.profitmandi.service.PostOfficeService;
-
 
29
import com.spice.profitmandi.service.catalog.BrandsService;
29
import in.shop2020.model.v1.user.CartStatus;
30
import in.shop2020.model.v1.user.CartStatus;
30
import org.apache.logging.log4j.LogManager;
31
import org.apache.logging.log4j.LogManager;
31
import org.apache.logging.log4j.Logger;
32
import org.apache.logging.log4j.Logger;
32
import org.springframework.beans.factory.annotation.Autowired;
33
import org.springframework.beans.factory.annotation.Autowired;
33
import org.springframework.beans.factory.annotation.Qualifier;
34
import org.springframework.beans.factory.annotation.Qualifier;
Line 144... Line 145...
144
    OfferPayoutRepository offerPayoutRepository;
145
    OfferPayoutRepository offerPayoutRepository;
145
 
146
 
146
    @Autowired
147
    @Autowired
147
    PartnerTypeChangeService partnerTypeChangeService;
148
    PartnerTypeChangeService partnerTypeChangeService;
148
 
149
 
-
 
150
    @Autowired
-
 
151
    BrandsService brandsService;
-
 
152
 
149
    @Override
153
    @Override
150
    public Map<String, Object> getByEmailIdOrMobileNumber(String emailIdOrMobileNumber) throws ProfitMandiBusinessException {
154
    public Map<String, Object> getByEmailIdOrMobileNumber(String emailIdOrMobileNumber) throws ProfitMandiBusinessException {
151
        User user = null;
155
        User user = null;
152
        int fofoId = Utils.SYSTEM_PARTNER_ID;
156
        int fofoId = Utils.SYSTEM_PARTNER_ID;
153
 
157
 
Line 185... Line 189...
185
                map.put("retailer", retailer);
189
                map.put("retailer", retailer);
186
 
190
 
187
                List<String> retailerBlockBrands = null;
191
                List<String> retailerBlockBrands = null;
188
                Set<String> brands = null;
192
                Set<String> brands = null;
189
                if (retailer.getId() != fofoId) {
193
                if (retailer.getId() != fofoId) {
190
                    brands = mongoClient.getMongoBrands(retailer.getId(), null, 3).stream().map(x -> (String) x.get("name")).collect(Collectors.toSet());
194
                    brands = brandsService.getBrands(retailer.getId(), null, 3).stream().map(x -> x.getName()).collect(Collectors.toSet());
191
                    retailerBlockBrands = retailerBlockBrandsRepository.selectAllByRetailer(retailer.getId()).stream().map(x -> x.getBlockBrands()).collect(Collectors.toList());
195
                    retailerBlockBrands = brandsService.partnerIneligibleBrands(fofoId);
192
 
196
 
193
                    LOGGER.info("loginDetailsFofoId" + retailer.getId());
-
 
194
                } else {
197
                } else {
195
                    LOGGER.info("fofoId" + fofoId);
198
                    LOGGER.info("fofoId" + fofoId);
196
                    brands = mongoClient.getMongoBrands(fofoId, null, 3).stream().map(x -> (String) x.get("name")).collect(Collectors.toSet());
199
                    brands = brandsService.getBrands(fofoId, null, 3).stream().map(x -> x.getName()).collect(Collectors.toSet());
197
                }
200
                }
198
                map.put("brands", brands);
201
                map.put("brands", brands);
199
                map.put("retailerBlockBrands", retailerBlockBrands);
202
                map.put("retailerBlockBrands", retailerBlockBrands);
200
 
203
 
201
                try {
204
                try {
Line 857... Line 860...
857
            String fofoStoreCode = StringUtils.generateFofoStoreSequence(
860
            String fofoStoreCode = StringUtils.generateFofoStoreSequence(
858
                    districtMaster.getStateShortName() + districtMaster.getShortName(), nextStoreCodeInt);
861
                    districtMaster.getStateShortName() + districtMaster.getShortName(), nextStoreCodeInt);
859
            fofoStore.setCode(fofoStoreCode);
862
            fofoStore.setCode(fofoStoreCode);
860
            fofoStore.setCodeInt(nextStoreCodeInt);
863
            fofoStore.setCodeInt(nextStoreCodeInt);
861
            fofoStore.setBagsLastCredited(LocalDateTime.now());
864
            fofoStore.setBagsLastCredited(LocalDateTime.now());
-
 
865
            if (retailerAddress.getName().contains(ProfitMandiConstants.COMPANY_NAME) || retailerAddress.getName().contains(ProfitMandiConstants.COMPANY_SHORT_NAME)) {
-
 
866
                fofoStore.setInternal(true);
-
 
867
            } else {
-
 
868
                fofoStore.setInternal(false);
-
 
869
            }
-
 
870
            fofoStore.setFofoType(FofoType.FRANCHISE);
862
            fofoStore.setFofoType(updateRetailerRequest.getFofoType());
871
            fofoStore.setFofoType(updateRetailerRequest.getFofoType());
863
            fofoStore.setActivationType(ActivationType.ACTIVE);
872
            fofoStore.setActivationType(ActivationType.ACTIVE);
864
            fofoStoreRepository.persist(fofoStore);
873
            fofoStoreRepository.persist(fofoStore);
865
 
874
 
866
            // Auto fill in onboarding Panel
875
            // Auto fill in onboarding Panel
Line 1196... Line 1205...
1196
 
1205
 
1197
    @Override
1206
    @Override
1198
    @Cacheable(value = "allFofoRetailersInternalFalse", cacheManager = "thirtyMinsTimeOutCacheManager")
1207
    @Cacheable(value = "allFofoRetailersInternalFalse", cacheManager = "thirtyMinsTimeOutCacheManager")
1199
    public Map<Integer, CustomRetailer> getAllFofoRetailersInternalFalse() throws ProfitMandiBusinessException {
1208
    public Map<Integer, CustomRetailer> getAllFofoRetailersInternalFalse() throws ProfitMandiBusinessException {
1200
        // TODO Auto-generated method stub
1209
        // TODO Auto-generated method stub
1201
        Stream<FofoStore> storeStream = fofoStoreRepository.selectAll().stream().filter(x-> !x.isInternal());
-
 
1202
 
-
 
1203
        List<Integer> storeIds = storeStream.map(x -> x.getId()).collect(Collectors.toList());
1210
        List<Integer> storeIds = fofoStoreRepository.selectAll().stream().filter(x -> x.getFofoType().equals(FofoType.FRANCHISE)).map(x -> x.getId()).collect(Collectors.toList());
1204
        return this.getFofoRetailers(storeIds);
1211
        return this.getFofoRetailers(storeIds);
1205
    }
1212
    }
1206
 
1213
 
1207
    @Override
1214
    @Override
1208
    public LoginRequestResponseModel registerWebUser(LoginRequestResponseModel loginRequestModel) throws
1215
    public LoginRequestResponseModel registerWebUser(LoginRequestResponseModel loginRequestModel) throws