| Line 15... |
Line 15... |
| 15 |
import org.springframework.stereotype.Component;
|
15 |
import org.springframework.stereotype.Component;
|
| 16 |
|
16 |
|
| 17 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
17 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 18 |
import com.spice.profitmandi.common.model.PriceModel;
|
18 |
import com.spice.profitmandi.common.model.PriceModel;
|
| 19 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
19 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| - |
|
20 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 20 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
21 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 21 |
import com.spice.profitmandi.dao.entity.dtr.GadgetCopsInsuranceCalc;
|
22 |
import com.spice.profitmandi.dao.entity.dtr.GadgetCopsInsuranceCalc;
|
| 22 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
- |
|
| 23 |
import com.spice.profitmandi.dao.entity.user.Address;
|
23 |
import com.spice.profitmandi.dao.entity.user.Address;
|
| - |
|
24 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| 24 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
25 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
| 25 |
import com.spice.profitmandi.dao.repository.dtr.GadgetCopsInsuranceCalcRepository;
|
26 |
import com.spice.profitmandi.dao.repository.dtr.GadgetCopsInsuranceCalcRepository;
|
| 26 |
import com.spice.profitmandi.dao.repository.dtr.InsuranceProviderRepository;
|
27 |
import com.spice.profitmandi.dao.repository.dtr.InsuranceProviderRepository;
|
| 27 |
import com.spice.profitmandi.dao.repository.dtr.RetailerRegisteredAddressRepository;
|
28 |
import com.spice.profitmandi.dao.repository.dtr.RetailerRegisteredAddressRepository;
|
| 28 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
29 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
| Line 38... |
Line 39... |
| 38 |
|
39 |
|
| 39 |
@Autowired
|
40 |
@Autowired
|
| 40 |
private AddressRepository addressRepository;
|
41 |
private AddressRepository addressRepository;
|
| 41 |
|
42 |
|
| 42 |
@Autowired
|
43 |
@Autowired
|
| - |
|
44 |
private ItemRepository itemRepository;
|
| - |
|
45 |
|
| - |
|
46 |
@Autowired
|
| 43 |
private SchemeService schemeService;
|
47 |
private SchemeService schemeService;
|
| 44 |
|
48 |
|
| 45 |
@Autowired
|
49 |
@Autowired
|
| 46 |
private TagService tagService;
|
50 |
private TagService tagService;
|
| 47 |
|
51 |
|
| Line 145... |
Line 149... |
| 145 |
public Map<Integer, PriceModel> getMopPrices(Set<Integer> itemIds, int retailerId) {
|
149 |
public Map<Integer, PriceModel> getMopPrices(Set<Integer> itemIds, int retailerId) {
|
| 146 |
//Set Price with max value
|
150 |
//Set Price with max value
|
| 147 |
Map<Integer, PriceModel> itemPriceMap = this.preparePriceModelDefaultValues(itemIds);
|
151 |
Map<Integer, PriceModel> itemPriceMap = this.preparePriceModelDefaultValues(itemIds);
|
| 148 |
List<TagListing> tagListings = this.getTagListing(itemIds, retailerId);
|
152 |
List<TagListing> tagListings = this.getTagListing(itemIds, retailerId);
|
| 149 |
for(TagListing tagListing : tagListings){
|
153 |
for(TagListing tagListing : tagListings){
|
| - |
|
154 |
Item item = null;
|
| - |
|
155 |
try {
|
| - |
|
156 |
item = itemRepository.selectById(tagListing.getItemId());
|
| - |
|
157 |
} catch (Exception e) {
|
| - |
|
158 |
LOGGER.info("Could not find item {}", tagListing.getItemId());
|
| - |
|
159 |
continue;
|
| - |
|
160 |
}
|
| 150 |
PriceModel priceModel = itemPriceMap.get(tagListing.getItemId());
|
161 |
PriceModel priceModel = itemPriceMap.get(tagListing.getItemId());
|
| 151 |
//In case of hot deal mop is set to retailer buying price
|
162 |
//In case of hot deal mop is set to retailer buying price
|
| - |
|
163 |
priceModel.setPurchasePrice(tagListing.getSellingPrice());
|
| - |
|
164 |
priceModel.setMrp(tagListing.getMrp());
|
| 152 |
if(tagListing.isHotDeals()) {
|
165 |
if(tagListing.isHotDeals()) {
|
| 153 |
priceModel.setMop(true);
|
166 |
priceModel.setMop(true);
|
| 154 |
priceModel.setPrice(tagListing.getSellingPrice());
|
167 |
priceModel.setPrice(tagListing.getSellingPrice());
|
| 155 |
priceModel.setPurchasePrice(tagListing.getSellingPrice());
|
- |
|
| 156 |
priceModel.setMrp(tagListing.getMrp());
|
- |
|
| 157 |
} else if(itemPriceMap.get(tagListing.getItemId()).getPrice() > tagListing.getMop()){
|
168 |
} else if(itemPriceMap.get(tagListing.getItemId()).getPrice() > tagListing.getMop()){
|
| 158 |
priceModel.setPrice(tagListing.getMop());
|
169 |
priceModel.setPrice(tagListing.getMop());
|
| 159 |
priceModel.setMop(true);
|
170 |
priceModel.setMop(true);
|
| 160 |
if(schemeService.getItemSchemeCashBack().get(tagListing.getItemId())!= null) {
|
171 |
if(schemeService.getItemSchemeCashBack().get(tagListing.getItemId())!= null) {
|
| 161 |
priceModel.setMaxDiscountAmount(schemeService.getItemSchemeCashBack().get(tagListing.getItemId()));
|
172 |
priceModel.setMaxDiscountAmount(schemeService.getItemSchemeCashBack().get(tagListing.getItemId()));
|
| 162 |
}
|
173 |
}
|
| - |
|
174 |
} else if (item.getHsnCode().equals("85171210")) {
|
| 163 |
priceModel.setPurchasePrice(tagListing.getSellingPrice());
|
175 |
priceModel.setMop(false);
|
| 164 |
priceModel.setMrp(tagListing.getMrp());
|
176 |
priceModel.setPrice(tagListing.getSellingPrice());
|
| 165 |
}
|
177 |
}
|
| 166 |
}
|
178 |
}
|
| 167 |
return itemPriceMap;
|
179 |
return itemPriceMap;
|
| 168 |
}
|
180 |
}
|
| 169 |
|
181 |
|