| Line 9... |
Line 9... |
| 9 |
import org.apache.commons.collections.CollectionUtils;
|
9 |
import org.apache.commons.collections.CollectionUtils;
|
| 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.dao.entity.catalog.TagListing;
|
15 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| - |
|
16 |
import com.spice.profitmandi.dao.entity.dtr.GadgetCopsInsuranceCalc;
|
| 15 |
import com.spice.profitmandi.dao.entity.user.Address;
|
17 |
import com.spice.profitmandi.dao.entity.user.Address;
|
| 16 |
import com.spice.profitmandi.dao.repository.catalog.PinCodeTagRepository;
|
18 |
import com.spice.profitmandi.dao.repository.catalog.PinCodeTagRepository;
|
| 17 |
import com.spice.profitmandi.dao.repository.catalog.RetailerTagRepository;
|
19 |
import com.spice.profitmandi.dao.repository.catalog.RetailerTagRepository;
|
| 18 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
20 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
| - |
|
21 |
import com.spice.profitmandi.dao.repository.dtr.GadgetCopsInsuranceCalcRepository;
|
| - |
|
22 |
import com.spice.profitmandi.dao.repository.dtr.InsuranceProviderRepository;
|
| 19 |
import com.spice.profitmandi.dao.repository.dtr.RetailerRegisteredAddressRepository;
|
23 |
import com.spice.profitmandi.dao.repository.dtr.RetailerRegisteredAddressRepository;
|
| 20 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
24 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
| 21 |
import com.spice.profitmandi.service.tag.TagService;
|
25 |
import com.spice.profitmandi.service.tag.TagService;
|
| 22 |
|
26 |
|
| 23 |
@Component
|
27 |
@Component
|
| Line 39... |
Line 43... |
| 39 |
RetailerTagRepository retailerTagRepository;
|
43 |
RetailerTagRepository retailerTagRepository;
|
| 40 |
|
44 |
|
| 41 |
@Autowired
|
45 |
@Autowired
|
| 42 |
TagListingRepository tagListingRepository;
|
46 |
TagListingRepository tagListingRepository;
|
| 43 |
|
47 |
|
| - |
|
48 |
@Autowired
|
| - |
|
49 |
InsuranceProviderRepository insuranceProviderRepository;
|
| - |
|
50 |
|
| - |
|
51 |
@Autowired
|
| - |
|
52 |
GadgetCopsInsuranceCalcRepository gadgetCopsInsuranceCalcRepository;
|
| - |
|
53 |
|
| 44 |
@Override
|
54 |
@Override
|
| 45 |
public Map<Integer, Float> getPrice(Set<Integer> itemIds, int retailerId) {
|
55 |
public Map<Integer, Float> getPrices(Set<Integer> itemIds, int retailerId) {
|
| 46 |
return getMopOrSellingPrice(itemIds, retailerId, false);
|
56 |
return getMopOrSellingPrice(itemIds, retailerId, false);
|
| 47 |
}
|
57 |
}
|
| 48 |
|
58 |
|
| 49 |
private Map<Integer, Float> preparePriceDefaultValues(Set<Integer> itemIds){
|
59 |
private Map<Integer, Float> preparePriceDefaultValues(Set<Integer> itemIds){
|
| 50 |
Map<Integer, Float> itemIdPrice = new HashMap<>(itemIds.size());
|
60 |
Map<Integer, Float> itemIdPrice = new HashMap<>(itemIds.size());
|
| Line 96... |
Line 106... |
| 96 |
}
|
106 |
}
|
| 97 |
return itemIdPrice;
|
107 |
return itemIdPrice;
|
| 98 |
}
|
108 |
}
|
| 99 |
|
109 |
|
| 100 |
@Override
|
110 |
@Override
|
| 101 |
public Map<Integer, Float> getMopPrice(Set<Integer> itemIds, int retailerId) {
|
111 |
public Map<Integer, Float> getMopPrices(Set<Integer> itemIds, int retailerId) {
|
| 102 |
return getMopOrSellingPrice(itemIds, retailerId, true);
|
112 |
return getMopOrSellingPrice(itemIds, retailerId, true);
|
| 103 |
}
|
113 |
}
|
| - |
|
114 |
|
| - |
|
115 |
@Override
|
| - |
|
116 |
public Map<Float, GadgetCopsInsuranceCalc> getInsurancePrices(Set<Float> prices, String providerName) throws ProfitMandiBusinessException{
|
| - |
|
117 |
insuranceProviderRepository.selectByName(providerName);
|
| - |
|
118 |
Map<Float, GadgetCopsInsuranceCalc> pricesMap = new HashMap<>();
|
| - |
|
119 |
if(ProfitMandiConstants.GADGET_COPS.equals(providerName)){
|
| - |
|
120 |
List<GadgetCopsInsuranceCalc> gadgetCopsInsuranceCalcs = gadgetCopsInsuranceCalcRepository.selectAll();
|
| - |
|
121 |
for(GadgetCopsInsuranceCalc gadgetCopsInsuranceCalc : gadgetCopsInsuranceCalcs){
|
| - |
|
122 |
for(float price : prices){
|
| - |
|
123 |
if(gadgetCopsInsuranceCalc.getPriceRangeMin()<= price && gadgetCopsInsuranceCalc.getPriceRangeMax() >= price){
|
| - |
|
124 |
pricesMap.put(price, gadgetCopsInsuranceCalc);
|
| - |
|
125 |
}
|
| - |
|
126 |
}
|
| - |
|
127 |
}
|
| - |
|
128 |
}else{
|
| - |
|
129 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.PROVIDER_NAME, providerName, "");
|
| - |
|
130 |
}
|
| - |
|
131 |
return pricesMap;
|
| - |
|
132 |
}
|
| 104 |
|
133 |
|
| 105 |
}
|
134 |
}
|