| Line 10... |
Line 10... |
| 10 |
import org.springframework.beans.factory.annotation.Autowired;
|
10 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 11 |
import org.springframework.stereotype.Component;
|
11 |
import org.springframework.stereotype.Component;
|
| 12 |
|
12 |
|
| 13 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
13 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 14 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
14 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| - |
|
15 |
import com.spice.profitmandi.dao.entity.catalog.PrivateDeal;
|
| 15 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
16 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 16 |
import com.spice.profitmandi.dao.entity.dtr.GadgetCopsInsuranceCalc;
|
17 |
import com.spice.profitmandi.dao.entity.dtr.GadgetCopsInsuranceCalc;
|
| 17 |
import com.spice.profitmandi.dao.entity.user.Address;
|
18 |
import com.spice.profitmandi.dao.entity.user.Address;
|
| 18 |
import com.spice.profitmandi.dao.repository.catalog.PinCodeTagRepository;
|
19 |
import com.spice.profitmandi.dao.repository.catalog.PinCodeTagRepository;
|
| - |
|
20 |
import com.spice.profitmandi.dao.repository.catalog.PrivateDealRepository;
|
| 19 |
import com.spice.profitmandi.dao.repository.catalog.RetailerTagRepository;
|
21 |
import com.spice.profitmandi.dao.repository.catalog.RetailerTagRepository;
|
| 20 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
22 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
| 21 |
import com.spice.profitmandi.dao.repository.dtr.GadgetCopsInsuranceCalcRepository;
|
23 |
import com.spice.profitmandi.dao.repository.dtr.GadgetCopsInsuranceCalcRepository;
|
| 22 |
import com.spice.profitmandi.dao.repository.dtr.InsuranceProviderRepository;
|
24 |
import com.spice.profitmandi.dao.repository.dtr.InsuranceProviderRepository;
|
| 23 |
import com.spice.profitmandi.dao.repository.dtr.RetailerRegisteredAddressRepository;
|
25 |
import com.spice.profitmandi.dao.repository.dtr.RetailerRegisteredAddressRepository;
|
| Line 49... |
Line 51... |
| 49 |
InsuranceProviderRepository insuranceProviderRepository;
|
51 |
InsuranceProviderRepository insuranceProviderRepository;
|
| 50 |
|
52 |
|
| 51 |
@Autowired
|
53 |
@Autowired
|
| 52 |
GadgetCopsInsuranceCalcRepository gadgetCopsInsuranceCalcRepository;
|
54 |
GadgetCopsInsuranceCalcRepository gadgetCopsInsuranceCalcRepository;
|
| 53 |
|
55 |
|
| - |
|
56 |
@Autowired
|
| - |
|
57 |
PrivateDealRepository privateDealRepository;
|
| - |
|
58 |
|
| 54 |
@Override
|
59 |
@Override
|
| 55 |
public Map<Integer, Float> getPrices(Set<Integer> itemIds, int retailerId) {
|
60 |
public Map<Integer, Float> getPrices(Set<Integer> itemIds, int retailerId) {
|
| 56 |
return getMopOrSellingPrice(itemIds, retailerId, false);
|
61 |
return getMopOrSellingPrice(itemIds, retailerId, false);
|
| 57 |
}
|
62 |
}
|
| 58 |
|
63 |
|
| Line 128... |
Line 133... |
| 128 |
}else{
|
133 |
}else{
|
| 129 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.PROVIDER_NAME, providerName, "");
|
134 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.PROVIDER_NAME, providerName, "");
|
| 130 |
}
|
135 |
}
|
| 131 |
return pricesMap;
|
136 |
return pricesMap;
|
| 132 |
}
|
137 |
}
|
| - |
|
138 |
|
| - |
|
139 |
@Override
|
| - |
|
140 |
public Map<Integer, Float> getPrivateDealPrices(Set<Integer> itemIds) {
|
| - |
|
141 |
List<PrivateDeal> privateDeals = privateDealRepository.selectByItemIds(itemIds);
|
| - |
|
142 |
Map<Integer, Float> privateDealsPriceMap = new HashMap<>();
|
| - |
|
143 |
for(PrivateDeal privateDeal : privateDeals){
|
| - |
|
144 |
privateDealsPriceMap.put(privateDeal.getItemId(), privateDeal.getDealPrice());
|
| - |
|
145 |
}
|
| - |
|
146 |
return privateDealsPriceMap;
|
| - |
|
147 |
}
|
| 133 |
|
148 |
|
| - |
|
149 |
@Override
|
| - |
|
150 |
public Map<Integer, Float> getPrivateDealPriceMopPriceNotFound(Set<Integer> itemIds, int retailerId) {
|
| - |
|
151 |
Map<Integer, Float> mopPriceMap = this.getMopPrices(itemIds, retailerId);
|
| - |
|
152 |
boolean fetchPrivateDealPrice = false;
|
| - |
|
153 |
for(Map.Entry<Integer, Float> entry : mopPriceMap.entrySet()){
|
| - |
|
154 |
if(entry.getValue() == Float.MAX_VALUE){
|
| - |
|
155 |
fetchPrivateDealPrice = true;
|
| - |
|
156 |
break;
|
| - |
|
157 |
}
|
| - |
|
158 |
}
|
| - |
|
159 |
if(fetchPrivateDealPrice){
|
| - |
|
160 |
Map<Integer, Float> privateDealsPriceMap = this.getPrivateDealPrices(itemIds);
|
| - |
|
161 |
for(Map.Entry<Integer, Float> entry : mopPriceMap.entrySet()){
|
| - |
|
162 |
if(entry.getValue() == Float.MAX_VALUE){
|
| - |
|
163 |
entry.setValue(privateDealsPriceMap.get(entry.getKey()));
|
| - |
|
164 |
}
|
| - |
|
165 |
}
|
| - |
|
166 |
}
|
| - |
|
167 |
return mopPriceMap;
|
| - |
|
168 |
}
|
| 134 |
}
|
169 |
}
|