| Line 39... |
Line 39... |
| 39 |
import com.spice.profitmandi.common.model.ProfitMandiResponse;
|
39 |
import com.spice.profitmandi.common.model.ProfitMandiResponse;
|
| 40 |
import com.spice.profitmandi.common.model.ResponseStatus;
|
40 |
import com.spice.profitmandi.common.model.ResponseStatus;
|
| 41 |
import com.spice.profitmandi.common.model.UserInfo;
|
41 |
import com.spice.profitmandi.common.model.UserInfo;
|
| 42 |
import com.spice.profitmandi.common.web.client.RestClient;
|
42 |
import com.spice.profitmandi.common.web.client.RestClient;
|
| 43 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
43 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| - |
|
44 |
import com.spice.profitmandi.dao.entity.inventory.ItemAvailabilityCache;
|
| 44 |
import com.spice.profitmandi.dao.enumuration.dtr.RoleType;
|
45 |
import com.spice.profitmandi.dao.enumuration.dtr.RoleType;
|
| 45 |
import com.spice.profitmandi.dao.model.UserCart;
|
46 |
import com.spice.profitmandi.dao.model.UserCart;
|
| 46 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
47 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
| 47 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
48 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
| - |
|
49 |
import com.spice.profitmandi.dao.repository.inventory.ItemAvailabilityCacheRepository;
|
| 48 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
50 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
| 49 |
import com.spice.profitmandi.service.pricing.PricingService;
|
51 |
import com.spice.profitmandi.service.pricing.PricingService;
|
| 50 |
import com.spice.profitmandi.web.res.AvailabilityInfo;
|
52 |
import com.spice.profitmandi.web.res.AvailabilityInfo;
|
| 51 |
import com.spice.profitmandi.web.res.DealBrands;
|
53 |
import com.spice.profitmandi.web.res.DealBrands;
|
| 52 |
import com.spice.profitmandi.web.res.DealObjectResponse;
|
54 |
import com.spice.profitmandi.web.res.DealObjectResponse;
|
| Line 68... |
Line 70... |
| 68 |
private String host;
|
70 |
private String host;
|
| 69 |
|
71 |
|
| 70 |
@Value("${python.api.port}")
|
72 |
@Value("${python.api.port}")
|
| 71 |
private int port;
|
73 |
private int port;
|
| 72 |
|
74 |
|
| - |
|
75 |
//This is now unused as we are not supporting multiple companies.
|
| 73 |
@Value("${fofo.warehouseIds}")
|
76 |
@Value("${fofo.warehouseIds}")
|
| 74 |
private int[] warehouseIds;
|
77 |
private int[] warehouseIds;
|
| 75 |
|
78 |
|
| 76 |
@Autowired
|
79 |
@Autowired
|
| 77 |
private PricingService pricingService;
|
80 |
private PricingService pricingService;
|
| Line 81... |
Line 84... |
| 81 |
|
84 |
|
| 82 |
@Autowired
|
85 |
@Autowired
|
| 83 |
private UserAccountRepository userAccountRepository;
|
86 |
private UserAccountRepository userAccountRepository;
|
| 84 |
|
87 |
|
| 85 |
@Autowired
|
88 |
@Autowired
|
| - |
|
89 |
private ItemAvailabilityCacheRepository itemAvailabilityCacheRepository;
|
| - |
|
90 |
|
| - |
|
91 |
@Autowired
|
| 86 |
private ResponseSender<?> responseSender;
|
92 |
private ResponseSender<?> responseSender;
|
| 87 |
|
93 |
|
| 88 |
@Autowired
|
94 |
@Autowired
|
| 89 |
private InventoryService inventoryService;
|
95 |
private InventoryService inventoryService;
|
| 90 |
|
96 |
|
| Line 205... |
Line 211... |
| 205 |
fdi.setSellingPrice((float)childItem.getDouble("sellingPrice_f"));
|
211 |
fdi.setSellingPrice((float)childItem.getDouble("sellingPrice_f"));
|
| 206 |
fdi.setMop((float)childItem.getDouble("mop_f"));
|
212 |
fdi.setMop((float)childItem.getDouble("mop_f"));
|
| 207 |
fdi.setColor(childItem.has("color_s")?childItem.getString("color_s"): "");
|
213 |
fdi.setColor(childItem.has("color_s")?childItem.getString("color_s"): "");
|
| 208 |
fdi.setTagId(childItem.getInt("tagId_i"));
|
214 |
fdi.setTagId(childItem.getInt("tagId_i"));
|
| 209 |
fdi.setItem_id(itemId);
|
215 |
fdi.setItem_id(itemId);
|
| - |
|
216 |
int totalAvailability = 0;
|
| - |
|
217 |
//Using item availability cache for now but can be changed to use caching later.
|
| - |
|
218 |
try {
|
| 210 |
fdi.setAvailability(inventoryService.getCachedAvailabilityByItemIdWarehouseIds(itemId, warehouseIds));
|
219 |
ItemAvailabilityCache iac = itemAvailabilityCacheRepository.selectByItemId(itemId);
|
| - |
|
220 |
totalAvailability = iac.getTotalAvailability();
|
| - |
|
221 |
} catch (Exception e) {}
|
| - |
|
222 |
fdi.setAvailability(totalAvailability);
|
| 211 |
fdi.setQuantityStep(1);
|
223 |
fdi.setQuantityStep(1);
|
| 212 |
fdi.setMinBuyQuantity(1);
|
224 |
fdi.setMinBuyQuantity(1);
|
| 213 |
fdi.setMaxQuantity(Math.min(fdi.getAvailability(), 100));
|
225 |
fdi.setMaxQuantity(Math.min(fdi.getAvailability(), 100));
|
| 214 |
if(fdi.getMaxQuantity() > 0) {
|
226 |
if(fdi.getMaxQuantity() > 0) {
|
| 215 |
fofoAvailabilityInfoMap.put(itemId, fdi);
|
227 |
fofoAvailabilityInfoMap.put(itemId, fdi);
|