| 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;
|
| 22 |
import java.util.List;
|
23 |
import java.util.List;
|
| 23 |
import java.util.Map;
|
24 |
import java.util.Map;
|
| 24 |
import java.util.stream.Collectors;
|
25 |
import java.util.stream.Collectors;
|
| 25 |
|
26 |
|
| 26 |
@Component
|
27 |
@Component
|
| Line 90... |
Line 91... |
| 90 |
}
|
91 |
}
|
| 91 |
|
92 |
|
| 92 |
@Override
|
93 |
@Override
|
| 93 |
public BrandAndAddToCartEligibleModel wodcompletBrands(int fofoId) throws ProfitMandiBusinessException {
|
94 |
public BrandAndAddToCartEligibleModel wodcompletBrands(int fofoId) throws ProfitMandiBusinessException {
|
| 94 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
95 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(fofoId);
|
| - |
|
96 |
if(!fofoStore.isInternal()){
|
| 95 |
PartnerOnBoardingPanel partnerOnBoardingPanel = partnerOnBoardingPanelRepository.selectByCode(fofoStore.getCode());
|
97 |
PartnerOnBoardingPanel partnerOnBoardingPanel = partnerOnBoardingPanelRepository.selectByCode(fofoStore.getCode());
|
| 96 |
List<PartnerDealerMapping> partnerDealerMappingList = new ArrayList<>();
|
98 |
List<PartnerDealerMapping> partnerDealerMappingList = new ArrayList<>();
|
| 97 |
List<String> wodCompletedBrands = new ArrayList<>();
|
99 |
List<String> wodCompletedBrands = new ArrayList<>();
|
| 98 |
if (partnerOnBoardingPanel != null) {
|
100 |
if (partnerOnBoardingPanel != null) {
|
| 99 |
partnerDealerMappingList = partnerDealerRepository.selectByOnboardingId(partnerOnBoardingPanel.getId());
|
101 |
partnerDealerMappingList = partnerDealerRepository.selectByOnboardingId(partnerOnBoardingPanel.getId());
|
| 100 |
if (partnerDealerMappingList != null && partnerDealerMappingList.size() > 0) {
|
102 |
if (partnerDealerMappingList != null && partnerDealerMappingList.size() > 0) {
|
| 101 |
//working brands -> Partner only work with brands that having 'Dealer Code'
|
103 |
//working brands -> Partner only work with brands that having 'Dealer Code'
|
| 102 |
wodCompletedBrands = partnerDealerMappingList.stream().filter(x -> x.getBrandCode().trim().length() > 0).map(x -> x.getBrand()).collect(Collectors.toList());
|
104 |
wodCompletedBrands = partnerDealerMappingList.stream().filter(x -> x.getBrandCode().trim().length() > 0).map(x -> x.getBrand()).collect(Collectors.toList());
|
| - |
|
105 |
}
|
| 103 |
}
|
106 |
}
|
| - |
|
107 |
BrandAndAddToCartEligibleModel partnerWorkingBrandMappingModel = new BrandAndAddToCartEligibleModel();
|
| - |
|
108 |
partnerWorkingBrandMappingModel.setWodCompleteBrands(wodCompletedBrands);
|
| - |
|
109 |
//brandsToBeCheck
|
| - |
|
110 |
List<String> wodRequiredBrand = brandCommitRepository.selectAllActiveBrand().stream().filter(x -> x.isNocRequired()).map(x -> x.getBrand()).collect(Collectors.toList());
|
| - |
|
111 |
partnerWorkingBrandMappingModel.setWodRequiredBrands(wodRequiredBrand);
|
| - |
|
112 |
return partnerWorkingBrandMappingModel;
|
| - |
|
113 |
}else {
|
| - |
|
114 |
BrandAndAddToCartEligibleModel model = new BrandAndAddToCartEligibleModel();
|
| - |
|
115 |
List<String> wodRequiredBrand = brandCommitRepository.selectAllActiveBrand().stream().filter(x -> x.isNocRequired()).map(x -> x.getBrand()).collect(Collectors.toList());
|
| - |
|
116 |
model.setWodCompleteBrands(wodRequiredBrand);
|
| - |
|
117 |
model.setWodRequiredBrands(wodRequiredBrand);
|
| - |
|
118 |
return model;
|
| 104 |
}
|
119 |
}
|
| 105 |
BrandAndAddToCartEligibleModel partnerWorkingBrandMappingModel = new BrandAndAddToCartEligibleModel();
|
- |
|
| 106 |
partnerWorkingBrandMappingModel.setWodCompleteBrands(wodCompletedBrands);
|
- |
|
| 107 |
//brandsToBeCheck
|
- |
|
| 108 |
List<String> wodRequiredBrand = brandCommitRepository.selectAllActiveBrand().stream().filter(x -> x.isNocRequired()).map(x -> x.getBrand()).collect(Collectors.toList());
|
- |
|
| 109 |
partnerWorkingBrandMappingModel.setWodRequiredBrands(wodRequiredBrand);
|
- |
|
| 110 |
return partnerWorkingBrandMappingModel;
|
- |
|
| 111 |
}
|
120 |
}
|
| 112 |
|
121 |
|
| 113 |
|
122 |
|
| 114 |
}
|
123 |
}
|