| Line 5... |
Line 5... |
| 5 |
import java.util.HashMap;
|
5 |
import java.util.HashMap;
|
| 6 |
import java.util.HashSet;
|
6 |
import java.util.HashSet;
|
| 7 |
import java.util.Iterator;
|
7 |
import java.util.Iterator;
|
| 8 |
import java.util.List;
|
8 |
import java.util.List;
|
| 9 |
import java.util.Map;
|
9 |
import java.util.Map;
|
| - |
|
10 |
import java.util.Optional;
|
| 10 |
import java.util.concurrent.atomic.AtomicInteger;
|
11 |
import java.util.concurrent.atomic.AtomicInteger;
|
| 11 |
import java.util.stream.Collectors;
|
12 |
import java.util.stream.Collectors;
|
| 12 |
|
13 |
|
| 13 |
import javax.servlet.http.HttpServletRequest;
|
14 |
import javax.servlet.http.HttpServletRequest;
|
| 14 |
|
15 |
|
| Line 18... |
Line 19... |
| 18 |
import org.apache.logging.log4j.Logger;
|
19 |
import org.apache.logging.log4j.Logger;
|
| 19 |
import org.json.JSONArray;
|
20 |
import org.json.JSONArray;
|
| 20 |
import org.json.JSONObject;
|
21 |
import org.json.JSONObject;
|
| 21 |
import org.springframework.beans.factory.annotation.Autowired;
|
22 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 22 |
import org.springframework.beans.factory.annotation.Value;
|
23 |
import org.springframework.beans.factory.annotation.Value;
|
| 23 |
import org.springframework.cache.annotation.Cacheable;
|
- |
|
| 24 |
import org.springframework.http.HttpStatus;
|
24 |
import org.springframework.http.HttpStatus;
|
| 25 |
import org.springframework.http.MediaType;
|
25 |
import org.springframework.http.MediaType;
|
| 26 |
import org.springframework.http.ResponseEntity;
|
26 |
import org.springframework.http.ResponseEntity;
|
| 27 |
import org.springframework.stereotype.Controller;
|
27 |
import org.springframework.stereotype.Controller;
|
| 28 |
import org.springframework.transaction.annotation.Transactional;
|
28 |
import org.springframework.transaction.annotation.Transactional;
|
| Line 55... |
Line 55... |
| 55 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
55 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
| 56 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
56 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
| 57 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
57 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
| 58 |
import com.spice.profitmandi.dao.repository.inventory.ItemAvailabilityCacheRepository;
|
58 |
import com.spice.profitmandi.dao.repository.inventory.ItemAvailabilityCacheRepository;
|
| 59 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
59 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| - |
|
60 |
import com.spice.profitmandi.service.inventory.ItemBucketService;
|
| 60 |
import com.spice.profitmandi.service.pricing.PricingService;
|
61 |
import com.spice.profitmandi.service.pricing.PricingService;
|
| 61 |
import com.spice.profitmandi.web.res.AvailabilityInfo;
|
62 |
import com.spice.profitmandi.web.res.AvailabilityInfo;
|
| 62 |
import com.spice.profitmandi.web.res.DealBrands;
|
63 |
import com.spice.profitmandi.web.res.DealBrands;
|
| 63 |
import com.spice.profitmandi.web.res.DealObjectResponse;
|
64 |
import com.spice.profitmandi.web.res.DealObjectResponse;
|
| 64 |
import com.spice.profitmandi.web.res.DealsResponse;
|
65 |
import com.spice.profitmandi.web.res.DealsResponse;
|
| Line 91... |
Line 92... |
| 91 |
@Autowired
|
92 |
@Autowired
|
| 92 |
private CategoryRepository categoryRepository;
|
93 |
private CategoryRepository categoryRepository;
|
| 93 |
|
94 |
|
| 94 |
@Autowired
|
95 |
@Autowired
|
| 95 |
private Mongo mongoClient;
|
96 |
private Mongo mongoClient;
|
| - |
|
97 |
|
| - |
|
98 |
@Autowired
|
| - |
|
99 |
private ItemBucketService itemBucketService;
|
| 96 |
|
100 |
|
| 97 |
@Autowired
|
101 |
@Autowired
|
| 98 |
private UserAccountRepository userAccountRepository;
|
102 |
private UserAccountRepository userAccountRepository;
|
| 99 |
|
103 |
|
| 100 |
@Autowired
|
104 |
@Autowired
|
| Line 169... |
Line 173... |
| 169 |
}
|
173 |
}
|
| 170 |
}
|
174 |
}
|
| 171 |
return responseSender.ok(responseObject);
|
175 |
return responseSender.ok(responseObject);
|
| 172 |
}
|
176 |
}
|
| 173 |
|
177 |
|
| - |
|
178 |
@RequestMapping(value = "fofo/buckets", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| - |
|
179 |
public ResponseEntity<?> getBuckets(HttpServletRequest request)
|
| - |
|
180 |
throws ProfitMandiBusinessException {
|
| - |
|
181 |
logger.info("Request " + request.getParameterMap());
|
| - |
|
182 |
return responseSender.ok(itemBucketService.getBuckets(Optional.of(true)));
|
| - |
|
183 |
}
|
| - |
|
184 |
|
| 174 |
private String getCommaSeparateTags(int userId) {
|
185 |
private String getCommaSeparateTags(int userId) {
|
| 175 |
UserCart uc = userAccountRepository.getUserCart(userId);
|
186 |
UserCart uc = userAccountRepository.getUserCart(userId);
|
| 176 |
List<Integer> tagIds = pricingService.getTagsIdsByRetailerId(uc.getUserId());
|
187 |
List<Integer> tagIds = pricingService.getTagsIdsByRetailerId(uc.getUserId());
|
| 177 |
List<String> strTagIds = new ArrayList<>();
|
188 |
List<String> strTagIds = new ArrayList<>();
|
| 178 |
for (Integer tagId : tagIds) {
|
189 |
for (Integer tagId : tagIds) {
|