Subversion Repositories SmartDukaan

Rev

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

Rev 34930 Rev 35203
Line 17... Line 17...
17
import com.spice.profitmandi.dao.repository.onboarding.BrandCommitRepository;
17
import com.spice.profitmandi.dao.repository.onboarding.BrandCommitRepository;
18
import org.springframework.beans.factory.annotation.Autowired;
18
import org.springframework.beans.factory.annotation.Autowired;
19
import org.springframework.stereotype.Component;
19
import org.springframework.stereotype.Component;
20
 
20
 
21
import java.util.ArrayList;
21
import java.util.ArrayList;
22
import java.util.Collections;
-
 
23
import java.util.List;
22
import java.util.List;
24
import java.util.Map;
23
import java.util.Map;
25
import java.util.stream.Collectors;
24
import java.util.stream.Collectors;
26
 
25
 
27
@Component
26
@Component
Line 52... Line 51...
52
    public List<BrandCatalog> getBrands(int fofoId, String email, int categoryId) throws ProfitMandiBusinessException {
51
    public List<BrandCatalog> getBrands(int fofoId, String email, int categoryId) throws ProfitMandiBusinessException {
53
        List<BrandCatalog> brandsDisplay = this.getBrandsToDisplay(categoryId);
52
        List<BrandCatalog> brandsDisplay = this.getBrandsToDisplay(categoryId);
54
        if (fofoId == Utils.SYSTEM_PARTNER_ID) {
53
        if (fofoId == Utils.SYSTEM_PARTNER_ID) {
55
            return brandsDisplay;
54
            return brandsDisplay;
56
        }
55
        }
57
        List<String> blockedBrands = retailerBlockBrandsRepository.selectAllByRetailer(fofoId).stream()
56
        List<String> ineligibleBrands = this.partnerIneligibleBrands(fofoId);
58
                .map(x -> x.getBlockBrands()).collect(Collectors.toList());
-
 
59
        brandsDisplay = brandsDisplay.stream().filter(x -> !blockedBrands.contains(x.getName()))
57
        brandsDisplay = brandsDisplay.stream().filter(x -> !ineligibleBrands.contains(x.getName()))
60
                .collect(Collectors.toList());
58
                .collect(Collectors.toList());
61
 
59
 
62
        return brandsDisplay;
60
        return brandsDisplay;
63
    }
61
    }
64
 
62