| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.web.controller;
|
1 |
package com.spice.profitmandi.web.controller;
|
| 2 |
|
2 |
|
| 3 |
import com.fasterxml.jackson.databind.ObjectMapper;
|
3 |
import com.fasterxml.jackson.databind.ObjectMapper;
|
| 4 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
4 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 5 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
- |
|
| 6 |
import com.spice.profitmandi.dao.entity.catalog.Catalog;
|
5 |
import com.spice.profitmandi.dao.entity.catalog.Catalog;
|
| 7 |
import com.spice.profitmandi.dao.entity.catalog.ModelHotDeal;
|
6 |
import com.spice.profitmandi.dao.entity.catalog.ModelHotDeal;
|
| 8 |
import com.spice.profitmandi.dao.repository.catalog.CatalogRepository;
|
7 |
import com.spice.profitmandi.dao.repository.catalog.CatalogRepository;
|
| 9 |
import com.spice.profitmandi.service.catalog.BrandsService;
|
8 |
import com.spice.profitmandi.service.catalog.BrandsService;
|
| 10 |
import com.spice.profitmandi.service.catalog.HotDealAttributes;
|
9 |
import com.spice.profitmandi.service.catalog.HotDealAttributes;
|
| Line 86... |
Line 85... |
| 86 |
return "response";
|
85 |
return "response";
|
| 87 |
}
|
86 |
}
|
| 88 |
|
87 |
|
| 89 |
@RequestMapping(value = "/hotDeals/models", method = RequestMethod.GET)
|
88 |
@RequestMapping(value = "/hotDeals/models", method = RequestMethod.GET)
|
| 90 |
public String getModelsForBrand(@RequestParam int brandId, Model model) throws Exception {
|
89 |
public String getModelsForBrand(@RequestParam int brandId, Model model) throws Exception {
|
| 91 |
List<Catalog> catalogs = catalogRepository.selectAllByBrandId(brandId,
|
90 |
List<Catalog> catalogs = catalogRepository.selectAllByBrandId(brandId);
|
| 92 |
ProfitMandiConstants.MOBILE_CATEGORY_ID);
|
- |
|
| 93 |
Set<Integer> activeIds = modelHotDealService.getDealsForBrand(brandId).stream()
|
91 |
Set<Integer> activeIds = modelHotDealService.getDealsForBrand(brandId).stream()
|
| 94 |
.filter(deal -> !"EXPIRED".equals(deal.getStatus()))
|
92 |
.filter(deal -> !"EXPIRED".equals(deal.getStatus()))
|
| 95 |
.map(ModelHotDeal::getCatalogItemId)
|
93 |
.map(ModelHotDeal::getCatalogItemId)
|
| 96 |
.collect(Collectors.toSet());
|
94 |
.collect(Collectors.toSet());
|
| 97 |
List<Map<String, Object>> models = catalogs.stream()
|
95 |
List<Map<String, Object>> models = catalogs.stream()
|