| Line 6... |
Line 6... |
| 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.Optional;
|
| - |
|
11 |
import java.util.Set;
|
| 11 |
import java.util.concurrent.atomic.AtomicInteger;
|
12 |
import java.util.concurrent.atomic.AtomicInteger;
|
| 12 |
import java.util.stream.Collectors;
|
13 |
import java.util.stream.Collectors;
|
| 13 |
|
14 |
|
| 14 |
import javax.servlet.http.HttpServletRequest;
|
15 |
import javax.servlet.http.HttpServletRequest;
|
| 15 |
|
16 |
|
| Line 186... |
Line 187... |
| 186 |
@RequestMapping(value = "/fofo/bucket", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
187 |
@RequestMapping(value = "/fofo/bucket", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 187 |
public ResponseEntity<?> getBucketDetails(HttpServletRequest request, @RequestParam int id)
|
188 |
public ResponseEntity<?> getBucketDetails(HttpServletRequest request, @RequestParam int id)
|
| 188 |
throws ProfitMandiBusinessException {
|
189 |
throws ProfitMandiBusinessException {
|
| 189 |
List<ItemQuantityPojo> iqPojo = itemBucketService.getBucketDetails(id);
|
190 |
List<ItemQuantityPojo> iqPojo = itemBucketService.getBucketDetails(id);
|
| 190 |
Map<Integer, Integer> itemIdsQtyMap = iqPojo.stream().collect(Collectors.toMap(x->x.getItemId(), x->x.getQuantity()));
|
191 |
Map<Integer, Integer> itemIdsQtyMap = iqPojo.stream().collect(Collectors.toMap(x->x.getItemId(), x->x.getQuantity()));
|
| 191 |
|
- |
|
| - |
|
192 |
Set<Integer> catalogIds = itemRepository.selectByIds(itemIdsQtyMap.keySet()).stream().map(x->x.getCatalogItemId()).collect(Collectors.toSet());
|
| 192 |
RestClient rc = new RestClient();
|
193 |
RestClient rc = new RestClient();
|
| 193 |
Map<String, String> params = new HashMap<>();
|
194 |
Map<String, String> params = new HashMap<>();
|
| 194 |
List<String> mandatoryQ = new ArrayList<>();
|
195 |
List<String> mandatoryQ = new ArrayList<>();
|
| 195 |
mandatoryQ.add(String.format("+{!parent which=\"id:catalog*\"} itemId_i:(%s)", StringUtils.join(itemIdsQtyMap.keySet(), " ")));
|
196 |
mandatoryQ.add(String.format("+{!parent which=\"id:catalog*\"} catalogId_i:(%s)", StringUtils.join(catalogIds, " ")));
|
| 196 |
|
- |
|
| - |
|
197 |
params.put("start", "0");
|
| - |
|
198 |
params.put("rows", "100");
|
| 197 |
params.put("q", StringUtils.join(mandatoryQ, " "));
|
199 |
params.put("q", StringUtils.join(mandatoryQ, " "));
|
| 198 |
params.put("fl", "*, [child parentFilter=id:catalog*]");
|
200 |
params.put("fl", "*, [child parentFilter=id:catalog*]");
|
| 199 |
|
201 |
|
| 200 |
params.put("wt", "json");
|
202 |
params.put("wt", "json");
|
| 201 |
String response = null;
|
203 |
String response = null;
|