Subversion Repositories SmartDukaan

Rev

Rev 33562 | Rev 33565 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 33562 Rev 33563
Line 292... Line 292...
292
                continue;
292
                continue;
293
            }
293
            }
294
 
294
 
295
            if (!catalogMap.containsKey(item.getCatalogItemId())) {
295
            if (!catalogMap.containsKey(item.getCatalogItemId())) {
296
 
296
 
297
                if (!priceModelMap.containsKey(tagListing.getSellingPrice()) && item.getCategoryId()==10006) {
297
                if (!priceModelMap.containsKey(tagListing.getSellingPrice()) && item.getCategoryId() == 10006) {
298
                    priceModelMap.put(tagListing.getSellingPrice(), new ArrayList<>());
298
                    priceModelMap.put(tagListing.getSellingPrice(), new ArrayList<>());
299
                }
299
                }
300
                List<Integer> priceModels = priceModelMap.get(tagListing.getSellingPrice());
300
                List<Integer> priceModels = priceModelMap.get(tagListing.getSellingPrice());
301
                priceModels.add(item.getCatalogItemId());
301
                priceModels.add(item.getCatalogItemId());
302
 
302
 
303
                Map<String, Object> catalogObj = new HashMap<>();
303
                Map<String, Object> catalogObj = new HashMap<>();
304
                if (similarModelsMap.containsKey(item.getCatalogItemId())) {
-
 
305
                    catalogObj.put("similarModels", similarModelsMap.get(item.getCatalogItemId()));
-
 
306
                } else {
-
 
307
                    catalogObj.put("similarModels", Collections.EMPTY_LIST);
-
 
308
                }
-
 
309
 
304
 
310
                catalogObj.put("feature", "");
305
                catalogObj.put("feature", "");
311
                catalogObj.put("hsnCode", item.getHsnCode());
306
                catalogObj.put("hsnCode", item.getHsnCode());
312
                catalogObj.put("title",
307
                catalogObj.put("title",
313
                        String.join(" ", Arrays.asList(item.getBrand(), item.getModelName(), item.getModelNumber())
308
                        String.join(" ", Arrays.asList(item.getBrand(), item.getModelName(), item.getModelNumber())
Line 456... Line 451...
456
            }
451
            }
457
 
452
 
458
            float starPrice = dp - 500f;
453
            float starPrice = dp - 500f;
459
            float endPrice = dp + 1000f;
454
            float endPrice = dp + 1000f;
460
            List<Integer> similalarModels = null;
455
            List<Integer> similalarModels = null;
461
            if((Integer)catalogValMap.get("categoryId")==3) {
456
            if ((Integer) catalogValMap.get("categoryId") == 3) {
462
                similalarModels = new ArrayList<>();
457
                similalarModels = new ArrayList<>();
463
                for (Entry<Float, List<Integer>> floatListEntry : priceModelMap.entrySet()) {
458
                for (Entry<Float, List<Integer>> floatListEntry : priceModelMap.entrySet()) {
464
                    float modelPrice = floatListEntry.getKey();
459
                    float modelPrice = floatListEntry.getKey();
465
                    if (modelPrice >= starPrice && modelPrice <= endPrice) {
460
                    if (modelPrice >= starPrice && modelPrice <= endPrice) {
466
                        similalarModels.addAll(floatListEntry.getValue());
461
                        similalarModels.addAll(floatListEntry.getValue());
467
                    }
462
                    }
468
                    if(modelPrice > endPrice) break;
463
                    if (modelPrice > endPrice) break;
469
                }
464
                }
470
                similalarModels.remove(catalogId);
465
                similalarModels.remove(catalogId);
471
            }
466
            }
472
 
467
 
473
 
468
 
Line 477... Line 472...
477
 
472
 
478
            SolrInputDocument catalogSolrObj = new SolrInputDocument();
473
            SolrInputDocument catalogSolrObj = new SolrInputDocument();
479
 
474
 
480
            catalogSolrObj.setField("id", "catalog" + catalogId);
475
            catalogSolrObj.setField("id", "catalog" + catalogId);
481
            catalogSolrObj.setField("rank_i", catalogValMap.get("rank"));
476
            catalogSolrObj.setField("rank_i", catalogValMap.get("rank"));
482
            catalogSolrObj.setField("similarModels_ii", similalarModels);
477
            catalogSolrObj.setField("similarModels_ii", similalarModels == null ? Collections.EMPTY_LIST : similalarModels);
483
            catalogSolrObj.setField("title_s", catalogValMap.get("title"));
478
            catalogSolrObj.setField("title_s", catalogValMap.get("title"));
484
            // catalogSolrObj.setField("_childDocuments_", itemObjs);
479
            // catalogSolrObj.setField("_childDocuments_", itemObjs);
485
            catalogSolrObj.addChildDocuments(itemObjs);
480
            catalogSolrObj.addChildDocuments(itemObjs);
486
            catalogSolrObj.setField("child_b", itemObjs.size() > 0);
481
            catalogSolrObj.setField("child_b", itemObjs.size() > 0);
487
            catalogSolrObj.setField("catalogId_i", catalogId);
482
            catalogSolrObj.setField("catalogId_i", catalogId);