| Line 202... |
Line 202... |
| 202 |
} catch (HttpHostConnectException e) {
|
202 |
} catch (HttpHostConnectException e) {
|
| 203 |
throw new ProfitMandiBusinessException("", "", "Could not connect to host");
|
203 |
throw new ProfitMandiBusinessException("", "", "Could not connect to host");
|
| 204 |
}
|
204 |
}
|
| 205 |
JSONObject solrResponseJSONObj = new JSONObject(response).getJSONObject("response");
|
205 |
JSONObject solrResponseJSONObj = new JSONObject(response).getJSONObject("response");
|
| 206 |
JSONArray docs = solrResponseJSONObj.getJSONArray("docs");
|
206 |
JSONArray docs = solrResponseJSONObj.getJSONArray("docs");
|
| - |
|
207 |
Map<Integer, TagListing> itemTagListingMap = null;
|
| 207 |
|
208 |
if(hotDeal) {
|
| 208 |
HashSet<Integer> itemsSet = new HashSet<>();
|
209 |
HashSet<Integer> itemsSet = new HashSet<>();
|
| 209 |
for(int i=0; i < docs.length(); i++) {
|
210 |
for(int i=0; i < docs.length(); i++) {
|
| 210 |
Map<Integer, FofoAvailabilityInfo> fofoAvailabilityInfoMap = new HashMap<>();
|
- |
|
| 211 |
JSONObject doc = docs.getJSONObject(i);
|
211 |
JSONObject doc = docs.getJSONObject(i);
|
| 212 |
for(int j=0; j< doc.getJSONArray("_childDocuments_").length(); j++) {
|
212 |
for(int j=0; j< doc.getJSONArray("_childDocuments_").length(); j++) {
|
| 213 |
JSONObject childItem = doc.getJSONArray("_childDocuments_").getJSONObject(j);
|
213 |
JSONObject childItem = doc.getJSONArray("_childDocuments_").getJSONObject(j);
|
| 214 |
int itemId = childItem.getInt("itemId_i");
|
214 |
int itemId = childItem.getInt("itemId_i");
|
| 215 |
itemsSet.add(itemId);
|
215 |
itemsSet.add(itemId);
|
| 216 |
}
|
216 |
}
|
| 217 |
}
|
217 |
}
|
| 218 |
Map<Integer, TagListing> itemTagListingMap = tagListingRepository.selectByItemIdsAndTagIds(itemsSet, new HashSet<>(tagIds)).stream()
|
218 |
itemTagListingMap = tagListingRepository.selectByItemIdsAndTagIds(itemsSet, new HashSet<>(tagIds)).stream()
|
| 219 |
.collect(Collectors.toMap(x->x.getItemId(), x->x));
|
219 |
.collect(Collectors.toMap(x->x.getItemId(), x->x));
|
| 220 |
|
220 |
}
|
| 221 |
|
221 |
|
| 222 |
for(int i=0; i < docs.length(); i++) {
|
222 |
for(int i=0; i < docs.length(); i++) {
|
| 223 |
Map<Integer, FofoAvailabilityInfo> fofoAvailabilityInfoMap = new HashMap<>();
|
223 |
Map<Integer, FofoAvailabilityInfo> fofoAvailabilityInfoMap = new HashMap<>();
|
| 224 |
JSONObject doc = docs.getJSONObject(i);
|
224 |
JSONObject doc = docs.getJSONObject(i);
|
| 225 |
FofoCatalogResponse ffdr = new FofoCatalogResponse();
|
225 |
FofoCatalogResponse ffdr = new FofoCatalogResponse();
|
| Line 230... |
Line 230... |
| 230 |
|
230 |
|
| 231 |
for(int j=0; j< doc.getJSONArray("_childDocuments_").length(); j++) {
|
231 |
for(int j=0; j< doc.getJSONArray("_childDocuments_").length(); j++) {
|
| 232 |
JSONObject childItem = doc.getJSONArray("_childDocuments_").getJSONObject(j);
|
232 |
JSONObject childItem = doc.getJSONArray("_childDocuments_").getJSONObject(j);
|
| 233 |
int itemId = childItem.getInt("itemId_i");
|
233 |
int itemId = childItem.getInt("itemId_i");
|
| 234 |
TagListing tl = itemTagListingMap.get(itemId);
|
234 |
TagListing tl = itemTagListingMap.get(itemId);
|
| 235 |
if(!tl.isHotDeals()) {
|
235 |
if(hotDeal && !tl.isHotDeals()) {
|
| 236 |
continue;
|
236 |
continue;
|
| 237 |
}
|
237 |
}
|
| 238 |
float sellingPrice = (float)childItem.getDouble("sellingPrice_f");
|
238 |
float sellingPrice = (float)childItem.getDouble("sellingPrice_f");
|
| 239 |
if(fofoAvailabilityInfoMap.containsKey(itemId)) {
|
239 |
if(fofoAvailabilityInfoMap.containsKey(itemId)) {
|
| 240 |
if(fofoAvailabilityInfoMap.get(itemId).getSellingPrice() > sellingPrice) {
|
240 |
if(fofoAvailabilityInfoMap.get(itemId).getSellingPrice() > sellingPrice) {
|