| Line 12... |
Line 12... |
| 12 |
import org.slf4j.LoggerFactory;
|
12 |
import org.slf4j.LoggerFactory;
|
| 13 |
import org.springframework.beans.factory.annotation.Autowired;
|
13 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 14 |
import org.springframework.stereotype.Component;
|
14 |
import org.springframework.stereotype.Component;
|
| 15 |
|
15 |
|
| 16 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
16 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| - |
|
17 |
import com.spice.profitmandi.common.model.MopPriceModel;
|
| 17 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
18 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 18 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
19 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 19 |
import com.spice.profitmandi.dao.entity.dtr.GadgetCopsInsuranceCalc;
|
20 |
import com.spice.profitmandi.dao.entity.dtr.GadgetCopsInsuranceCalc;
|
| 20 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
21 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
| 21 |
import com.spice.profitmandi.dao.entity.user.Address;
|
22 |
import com.spice.profitmandi.dao.entity.user.Address;
|
| Line 153... |
Line 154... |
| 153 |
return purchasePriceMap;
|
154 |
return purchasePriceMap;
|
| 154 |
}
|
155 |
}
|
| 155 |
|
156 |
|
| 156 |
|
157 |
|
| 157 |
@Override
|
158 |
@Override
|
| 158 |
public Map<Integer, Float> getPurchasePriceMopPriceNotFound(Set<Integer> itemIds, int retailerId) {
|
159 |
public Map<Integer, MopPriceModel> getPurchasePriceMopPriceNotFound(Set<Integer> itemIds, int retailerId) {
|
| 159 |
Map<Integer, Float> mopPriceMap = this.getMopPrices(itemIds, retailerId);
|
160 |
Map<Integer, Float> mopPriceMap = this.getMopPrices(itemIds, retailerId);
|
| - |
|
161 |
Map<Integer, MopPriceModel> mopPriceModelMap = new HashMap<>();
|
| 160 |
boolean fetchPurchasePrice = false;
|
162 |
boolean fetchPurchasePrice = false;
|
| 161 |
for(Map.Entry<Integer, Float> entry : mopPriceMap.entrySet()){
|
163 |
for(Map.Entry<Integer, Float> entry : mopPriceMap.entrySet()){
|
| - |
|
164 |
MopPriceModel mopPriceModel = new MopPriceModel();
|
| - |
|
165 |
mopPriceModel.setPrice(entry.getValue());
|
| 162 |
if(entry.getValue() == Float.MAX_VALUE){
|
166 |
if(entry.getValue() == Float.MAX_VALUE || entry.getValue() == 0f) {
|
| 163 |
fetchPurchasePrice = true;
|
167 |
fetchPurchasePrice = true;
|
| - |
|
168 |
mopPriceModel.setMop(false);
|
| 164 |
break;
|
169 |
}else{
|
| - |
|
170 |
mopPriceModel.setMop(false);
|
| 165 |
}
|
171 |
}
|
| - |
|
172 |
mopPriceModelMap.put(entry.getKey(), mopPriceModel);
|
| 166 |
}
|
173 |
}
|
| - |
|
174 |
|
| 167 |
if(fetchPurchasePrice){
|
175 |
if(fetchPurchasePrice){
|
| 168 |
Map<Integer, Float> purchasePriceMap = this.getPurchasePrices(itemIds, retailerId);
|
176 |
Map<Integer, Float> purchasePriceMap = this.getPurchasePrices(itemIds, retailerId);
|
| 169 |
LOGGER.info("mopPrice [18000={}]", mopPriceMap.get(18000));
|
- |
|
| 170 |
LOGGER.info("purchasePrice [18000={}]", purchasePriceMap.get(18000));
|
- |
|
| 171 |
for(Map.Entry<Integer, Float> entry : mopPriceMap.entrySet()){
|
177 |
for(Map.Entry<Integer, MopPriceModel> entry : mopPriceModelMap.entrySet()){
|
| 172 |
if(entry.getValue() == Float.MAX_VALUE || entry.getValue() == 0f){
|
178 |
if(!entry.getValue().isMop()){
|
| 173 |
entry.setValue(purchasePriceMap.get(entry.getKey()));
|
179 |
entry.getValue().setPrice(purchasePriceMap.get(entry.getKey()));
|
| 174 |
}
|
180 |
}
|
| 175 |
}
|
181 |
}
|
| 176 |
}
|
182 |
}
|
| - |
|
183 |
|
| 177 |
return mopPriceMap;
|
184 |
return mopPriceModelMap;
|
| 178 |
}
|
185 |
}
|
| 179 |
|
186 |
|
| 180 |
//Currently it only handles fofos
|
187 |
//Currently it only handles fofos
|
| 181 |
public List<Integer> getTagsIdsByRetailerId(int retailerId) throws Throwable{
|
188 |
public List<Integer> getTagsIdsByRetailerId(int retailerId) throws Throwable{
|
| 182 |
//int addressId = retailerRegisteredAddressRepository.selectAddressIdByRetailerId(retailerId);
|
189 |
//int addressId = retailerRegisteredAddressRepository.selectAddressIdByRetailerId(retailerId);
|