| Line 12... |
Line 12... |
| 12 |
import com.spice.profitmandi.dao.entity.user.CartLine;
|
12 |
import com.spice.profitmandi.dao.entity.user.CartLine;
|
| 13 |
import com.spice.profitmandi.dao.entity.user.User;
|
13 |
import com.spice.profitmandi.dao.entity.user.User;
|
| 14 |
import com.spice.profitmandi.dao.model.*;
|
14 |
import com.spice.profitmandi.dao.model.*;
|
| 15 |
import com.spice.profitmandi.dao.repository.catalog.FocusedModelRepository;
|
15 |
import com.spice.profitmandi.dao.repository.catalog.FocusedModelRepository;
|
| 16 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
16 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| - |
|
17 |
import com.spice.profitmandi.dao.repository.catalog.ModelHotDealRepository;
|
| 17 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
18 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
| 18 |
import com.spice.profitmandi.dao.repository.cs.PartnerRegionRepository;
|
19 |
import com.spice.profitmandi.dao.repository.cs.PartnerRegionRepository;
|
| 19 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
20 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 20 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
21 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
| 21 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
22 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
| Line 70... |
Line 71... |
| 70 |
UserRepository saholicUserRepository;
|
71 |
UserRepository saholicUserRepository;
|
| 71 |
|
72 |
|
| 72 |
@Autowired
|
73 |
@Autowired
|
| 73 |
ItemRepository itemRepository;
|
74 |
ItemRepository itemRepository;
|
| 74 |
|
75 |
|
| - |
|
76 |
@Autowired
|
| - |
|
77 |
ModelHotDealRepository modelHotDealRepository;
|
| - |
|
78 |
|
| 75 |
|
79 |
|
| 76 |
@Autowired
|
80 |
@Autowired
|
| 77 |
CurrentInventorySnapshotRepository currentInventorySnapshotRepository;
|
81 |
CurrentInventorySnapshotRepository currentInventorySnapshotRepository;
|
| 78 |
|
82 |
|
| 79 |
@Autowired
|
83 |
@Autowired
|
| Line 147... |
Line 151... |
| 147 |
|
151 |
|
| 148 |
// As of now it only works for Fofo Partners need to be refactored later
|
152 |
// As of now it only works for Fofo Partners need to be refactored later
|
| 149 |
private Map<Integer, Integer> getAvailabilityMap(User user, Set<Integer> itemIds) {
|
153 |
private Map<Integer, Integer> getAvailabilityMap(User user, Set<Integer> itemIds) {
|
| 150 |
Map<Integer, Integer> itemAvailabilityMap = new HashMap<>();
|
154 |
Map<Integer, Integer> itemAvailabilityMap = new HashMap<>();
|
| 151 |
List<TagListing> tags = tagListingRepository.selectByItemIdsAndTagIds(itemIds, tagIds);
|
155 |
List<TagListing> tags = tagListingRepository.selectByItemIdsAndTagIds(itemIds, tagIds);
|
| - |
|
156 |
// Hot deals live in catalog.model_hot_deal (date-windowed), not tag_listing.hot_deals
|
| - |
|
157 |
Set<Integer> hotDealCatalogIds = modelHotDealRepository.selectActiveCatalogIds(LocalDate.now());
|
| - |
|
158 |
Map<Integer, Integer> itemCatalogMap = new HashMap<>();
|
| - |
|
159 |
try {
|
| - |
|
160 |
for (Item item : itemRepository.selectByIds(itemIds)) {
|
| - |
|
161 |
itemCatalogMap.put(item.getId(), item.getCatalogItemId());
|
| - |
|
162 |
}
|
| - |
|
163 |
} catch (ProfitMandiBusinessException e) {
|
| - |
|
164 |
logger.error("Could not load items for availability map", e);
|
| - |
|
165 |
}
|
| 152 |
tags.stream().forEach(tagListing -> {
|
166 |
tags.stream().forEach(tagListing -> {
|
| 153 |
if (!tagListing.isActive() || tagListing.isHotDeals()) {
|
167 |
if (!tagListing.isActive()
|
| - |
|
168 |
|| hotDealCatalogIds.contains(itemCatalogMap.get(tagListing.getItemId()))) {
|
| 154 |
// show actual values here
|
169 |
// show actual values here
|
| 155 |
} else {
|
170 |
} else {
|
| 156 |
itemAvailabilityMap.put(tagListing.getItemId(), 400);
|
171 |
itemAvailabilityMap.put(tagListing.getItemId(), 400);
|
| 157 |
}
|
172 |
}
|
| 158 |
});
|
173 |
});
|