| Line 14... |
Line 14... |
| 14 |
import com.spice.profitmandi.common.model.UserInfo;
|
14 |
import com.spice.profitmandi.common.model.UserInfo;
|
| 15 |
import com.spice.profitmandi.common.solr.SolrService;
|
15 |
import com.spice.profitmandi.common.solr.SolrService;
|
| 16 |
import com.spice.profitmandi.common.web.client.RestClient;
|
16 |
import com.spice.profitmandi.common.web.client.RestClient;
|
| 17 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
17 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 18 |
import com.spice.profitmandi.dao.entity.catalog.*;
|
18 |
import com.spice.profitmandi.dao.entity.catalog.*;
|
| - |
|
19 |
import com.spice.profitmandi.dao.entity.dtr.WebListing;
|
| 19 |
import com.spice.profitmandi.dao.entity.dtr.WebOffer;
|
20 |
import com.spice.profitmandi.dao.entity.dtr.WebOffer;
|
| 20 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
21 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 21 |
import com.spice.profitmandi.dao.entity.fofo.SuggestedPo;
|
22 |
import com.spice.profitmandi.dao.entity.fofo.SuggestedPo;
|
| 22 |
import com.spice.profitmandi.dao.entity.fofo.SuggestedPoDetail;
|
23 |
import com.spice.profitmandi.dao.entity.fofo.SuggestedPoDetail;
|
| 23 |
import com.spice.profitmandi.dao.entity.inventory.SaholicCISTable;
|
24 |
import com.spice.profitmandi.dao.entity.inventory.SaholicCISTable;
|
| 24 |
import com.spice.profitmandi.dao.entity.inventory.SaholicPOItem;
|
25 |
import com.spice.profitmandi.dao.entity.inventory.SaholicPOItem;
|
| - |
|
26 |
import com.spice.profitmandi.dao.enumuration.dtr.WebListingType;
|
| 25 |
import com.spice.profitmandi.dao.model.CreateOfferRequest;
|
27 |
import com.spice.profitmandi.dao.model.CreateOfferRequest;
|
| 26 |
import com.spice.profitmandi.dao.model.UserCart;
|
28 |
import com.spice.profitmandi.dao.model.UserCart;
|
| 27 |
import com.spice.profitmandi.dao.repository.catalog.*;
|
29 |
import com.spice.profitmandi.dao.repository.catalog.*;
|
| 28 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
30 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 29 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
31 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
| Line 31... |
Line 33... |
| 31 |
import com.spice.profitmandi.dao.repository.dtr.WebOfferRepository;
|
33 |
import com.spice.profitmandi.dao.repository.dtr.WebOfferRepository;
|
| 32 |
import com.spice.profitmandi.dao.repository.fofo.SuggestedPoDetailRepository;
|
34 |
import com.spice.profitmandi.dao.repository.fofo.SuggestedPoDetailRepository;
|
| 33 |
import com.spice.profitmandi.dao.repository.fofo.SuggestedPoRepository;
|
35 |
import com.spice.profitmandi.dao.repository.fofo.SuggestedPoRepository;
|
| 34 |
import com.spice.profitmandi.dao.repository.inventory.SaholicCISTableRepository;
|
36 |
import com.spice.profitmandi.dao.repository.inventory.SaholicCISTableRepository;
|
| 35 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
37 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| - |
|
38 |
import com.spice.profitmandi.service.catalog.BrandsService;
|
| 36 |
import com.spice.profitmandi.service.inventory.*;
|
39 |
import com.spice.profitmandi.service.inventory.*;
|
| 37 |
import com.spice.profitmandi.service.pricecircular.PriceCircularItemModel;
|
40 |
import com.spice.profitmandi.service.pricecircular.PriceCircularItemModel;
|
| 38 |
import com.spice.profitmandi.service.pricecircular.PriceCircularModel;
|
41 |
import com.spice.profitmandi.service.pricecircular.PriceCircularModel;
|
| 39 |
import com.spice.profitmandi.service.pricecircular.PriceCircularService;
|
42 |
import com.spice.profitmandi.service.pricecircular.PriceCircularService;
|
| 40 |
import com.spice.profitmandi.service.pricing.PricingService;
|
43 |
import com.spice.profitmandi.service.pricing.PricingService;
|
| Line 147... |
Line 150... |
| 147 |
private ComboModelRepository comboModelRepository;
|
150 |
private ComboModelRepository comboModelRepository;
|
| 148 |
|
151 |
|
| 149 |
@Autowired
|
152 |
@Autowired
|
| 150 |
private ComboMappedModelRepository comboMappedModelRepository;
|
153 |
private ComboMappedModelRepository comboMappedModelRepository;
|
| 151 |
|
154 |
|
| - |
|
155 |
@Autowired
|
| - |
|
156 |
private BrandsService brandsService;
|
| 152 |
List<String> filterableParams = Arrays.asList("brand");
|
157 |
List<String> filterableParams = Arrays.asList("brand");
|
| 153 |
|
158 |
|
| 154 |
@RequestMapping(value = "/fofo/buckets", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
159 |
@RequestMapping(value = "/fofo/buckets", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 155 |
public ResponseEntity<?> getBuckets(HttpServletRequest request) throws ProfitMandiBusinessException {
|
160 |
public ResponseEntity<?> getBuckets(HttpServletRequest request) throws ProfitMandiBusinessException {
|
| 156 |
logger.info("Request " + request.getParameterMap());
|
161 |
logger.info("Request " + request.getParameterMap());
|
| Line 226... |
Line 231... |
| 226 |
return responseSender.ok(dealResponse);
|
231 |
return responseSender.ok(dealResponse);
|
| 227 |
}
|
232 |
}
|
| 228 |
|
233 |
|
| 229 |
@RequestMapping(value = "/suggestedPo/status", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
234 |
@RequestMapping(value = "/suggestedPo/status", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 230 |
@ApiImplicitParams({
|
235 |
@ApiImplicitParams({
|
| 231 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
236 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| 232 |
@ApiOperation(value = "")
|
237 |
@ApiOperation(value = "")
|
| 233 |
public ResponseEntity<?> changeSuggestedPoStatus(HttpServletRequest request, @RequestParam int id)
|
238 |
public ResponseEntity<?> changeSuggestedPoStatus(HttpServletRequest request, @RequestParam int id)
|
| 234 |
throws ProfitMandiBusinessException {
|
239 |
throws ProfitMandiBusinessException {
|
| 235 |
SuggestedPo suggestedPo = suggestedPoRepository.selectById(id);
|
240 |
SuggestedPo suggestedPo = suggestedPoRepository.selectById(id);
|
| 236 |
suggestedPo.setStatus("closed");
|
241 |
suggestedPo.setStatus("closed");
|
| Line 247... |
Line 252... |
| 247 |
}
|
252 |
}
|
| 248 |
return String.join(",", strTagIds);
|
253 |
return String.join(",", strTagIds);
|
| 249 |
}
|
254 |
}
|
| 250 |
|
255 |
|
| 251 |
@ApiImplicitParams({
|
256 |
@ApiImplicitParams({
|
| 252 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
257 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| 253 |
@RequestMapping(value = "/fofo", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
258 |
@RequestMapping(value = "/fofo", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 254 |
public ResponseEntity<?> getFofo(HttpServletRequest request,
|
259 |
public ResponseEntity<?> getFofo(HttpServletRequest request,
|
| 255 |
@RequestParam(value = "categoryId", required = false, defaultValue = "3") String categoryId,
|
260 |
@RequestParam(value = "categoryId", required = false, defaultValue = "3") String categoryId,
|
| 256 |
@RequestParam(value = "offset") String offset, @RequestParam(value = "limit") String limit,
|
261 |
@RequestParam(value = "offset") String offset, @RequestParam(value = "limit") String limit,
|
| 257 |
@RequestParam(value = "sort", required = false) String sort,
|
262 |
@RequestParam(value = "sort", required = false) String sort,
|
| 258 |
@RequestParam(value = "brand", required = false) String brand,
|
263 |
@RequestParam(value = "brand", required = false) String brand,
|
| 259 |
@RequestParam(value = "subCategoryId", required = false) int subCategoryId,
|
264 |
@RequestParam(value = "subCategoryId", required = false) int subCategoryId,
|
| 260 |
@RequestParam(value = "q", required = false) String queryTerm,
|
265 |
@RequestParam(value = "q", required = false) String queryTerm,
|
| 261 |
@RequestParam(value = "hotDeal", required = false) boolean hotDeal) throws Throwable {
|
266 |
@RequestParam(value = "hotDeal", required = false) boolean hotDeal) throws Throwable {
|
| 262 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
267 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
| 263 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
268 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| 264 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(userInfo.getRetailerId());
|
269 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(userInfo.getRetailerId());
|
| 265 |
sort = "w" + fs.getWarehouseId() + "_i desc";
|
270 |
sort = "w" + fs.getWarehouseId() + "_i desc";
|
| 266 |
dealResponse = this.getCatalogResponse(
|
271 |
dealResponse = this.getCatalogResponse(
|
| Line 270... |
Line 275... |
| 270 |
return responseSender.ok(dealResponse);
|
275 |
return responseSender.ok(dealResponse);
|
| 271 |
}
|
276 |
}
|
| 272 |
|
277 |
|
| 273 |
@RequestMapping(value = "/online-deals", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
278 |
@RequestMapping(value = "/online-deals", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 274 |
@ApiImplicitParams({
|
279 |
@ApiImplicitParams({
|
| 275 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
280 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| 276 |
@ApiOperation(value = "Get online deals")
|
281 |
@ApiOperation(value = "Get online deals")
|
| 277 |
public ResponseEntity<?> getOnlineDeals(HttpServletRequest request,
|
282 |
public ResponseEntity<?> getOnlineDeals(HttpServletRequest request,
|
| 278 |
@RequestParam(value = "categoryId") String categoryId, @RequestParam(value = "offset") String offset,
|
283 |
@RequestParam(value = "categoryId") String categoryId, @RequestParam(value = "offset") String offset,
|
| 279 |
@RequestParam(value = "limit") String limit, @RequestParam(value = "sort", required = false) String sort,
|
284 |
@RequestParam(value = "limit") String limit, @RequestParam(value = "sort", required = false) String sort,
|
| 280 |
@RequestParam(value = "direction", required = false) String direction,
|
285 |
@RequestParam(value = "direction", required = false) String direction,
|
| 281 |
@RequestParam(value = "filterData", required = false) String filterData) throws Throwable {
|
286 |
@RequestParam(value = "filterData", required = false) String filterData) throws Throwable {
|
| 282 |
logger.info("Request " + request.getParameterMap());
|
287 |
logger.info("Request " + request.getParameterMap());
|
| 283 |
String response = null;
|
288 |
String response = null;
|
| 284 |
int userId = (int) request.getAttribute("userId");
|
289 |
int userId = (int) request.getAttribute("userId");
|
| 285 |
|
290 |
|
| 286 |
String uri = "/deals/" + userId;
|
291 |
String uri = "/deals/" + userId;
|
| Line 325... |
Line 330... |
| 325 |
return new Gson().fromJson(jsonObject.toString(), DealsResponse.class);
|
330 |
return new Gson().fromJson(jsonObject.toString(), DealsResponse.class);
|
| 326 |
}
|
331 |
}
|
| 327 |
|
332 |
|
| 328 |
@RequestMapping(value = ProfitMandiConstants.URL_BRANDS, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
333 |
@RequestMapping(value = ProfitMandiConstants.URL_BRANDS, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 329 |
@ApiImplicitParams({
|
334 |
@ApiImplicitParams({
|
| 330 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
335 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| 331 |
@ApiOperation(value = "Get brand list and count for category")
|
336 |
@ApiOperation(value = "Get brand list and count for category")
|
| 332 |
public ResponseEntity<?> getBrands(HttpServletRequest request,
|
337 |
public ResponseEntity<?> getBrands(HttpServletRequest request,
|
| 333 |
@RequestParam(value = "category_id") String category_id) throws ProfitMandiBusinessException {
|
338 |
@RequestParam(value = "category_id") String category_id) throws ProfitMandiBusinessException {
|
| 334 |
logger.info("Request " + request.getParameterMap());
|
339 |
logger.info("Request " + request.getParameterMap());
|
| 335 |
String response = null;
|
340 |
String response = null;
|
| 336 |
// TODO: move to properties
|
341 |
// TODO: move to properties
|
| 337 |
String uri = ProfitMandiConstants.URL_BRANDS;
|
342 |
String uri = ProfitMandiConstants.URL_BRANDS;
|
| 338 |
RestClient rc = new RestClient();
|
343 |
RestClient rc = new RestClient();
|
| Line 351... |
Line 356... |
| 351 |
return responseSender.ok(dealBrandsResponse);
|
356 |
return responseSender.ok(dealBrandsResponse);
|
| 352 |
}
|
357 |
}
|
| 353 |
|
358 |
|
| 354 |
@RequestMapping(value = ProfitMandiConstants.URL_UNIT_DEAL, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
359 |
@RequestMapping(value = ProfitMandiConstants.URL_UNIT_DEAL, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 355 |
@ApiImplicitParams({
|
360 |
@ApiImplicitParams({
|
| 356 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
361 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| 357 |
@ApiOperation(value = "Get unit deal object")
|
362 |
@ApiOperation(value = "Get unit deal object")
|
| 358 |
public ResponseEntity<?> getUnitDeal(HttpServletRequest request, @PathVariable(value = "id") long id)
|
363 |
public ResponseEntity<?> getUnitDeal(HttpServletRequest request, @PathVariable(value = "id") long id)
|
| 359 |
throws ProfitMandiBusinessException {
|
364 |
throws ProfitMandiBusinessException {
|
| 360 |
String response = null;
|
365 |
String response = null;
|
| 361 |
// TODO: move to properties
|
366 |
// TODO: move to properties
|
| Line 383... |
Line 388... |
| 383 |
return responseSender.ok(dealsResponse);
|
388 |
return responseSender.ok(dealsResponse);
|
| 384 |
}
|
389 |
}
|
| 385 |
|
390 |
|
| 386 |
@RequestMapping(value = "/partnerdeals/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
391 |
@RequestMapping(value = "/partnerdeals/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 387 |
@ApiImplicitParams({
|
392 |
@ApiImplicitParams({
|
| 388 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
393 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| 389 |
@ApiOperation(value = "Get unit deal object")
|
394 |
@ApiOperation(value = "Get unit deal object")
|
| 390 |
public ResponseEntity<?> getUnitFocoDeal(HttpServletRequest request, @PathVariable(value = "id") long id)
|
395 |
public ResponseEntity<?> getUnitFocoDeal(HttpServletRequest request, @PathVariable(value = "id") long id)
|
| 391 |
throws Exception {
|
396 |
throws Exception {
|
| 392 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
397 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
| 393 |
List<Integer> tagIds = Arrays.asList(4);
|
398 |
List<Integer> tagIds = Arrays.asList(4);
|
| Line 423... |
Line 428... |
| 423 |
return responseSender.ok(dealResponse.get(0));
|
428 |
return responseSender.ok(dealResponse.get(0));
|
| 424 |
}
|
429 |
}
|
| 425 |
|
430 |
|
| 426 |
@RequestMapping(value = "/fofo/brands", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
431 |
@RequestMapping(value = "/fofo/brands", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 427 |
public ResponseEntity<?> getBrandsToDisplay(HttpServletRequest request,
|
432 |
public ResponseEntity<?> getBrandsToDisplay(HttpServletRequest request,
|
| 428 |
@RequestParam(required = false, defaultValue = "0") int categoryId) throws Exception {
|
433 |
@RequestParam(required = false, defaultValue = "0") int categoryId) throws Exception {
|
| 429 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
434 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| 430 |
logger.info("userInfo [{}]", userInfo);
|
435 |
logger.info("userInfo [{}]", userInfo);
|
| 431 |
List<DBObject> brandsDisplay = mongoClient.getMongoBrands(userInfo.getRetailerId(), userInfo.getEmail(),
|
436 |
List<DBObject> brandsDisplay = mongoClient.getMongoBrands(userInfo.getRetailerId(), userInfo.getEmail(),
|
| 432 |
categoryId);
|
437 |
categoryId);
|
| 433 |
return new ResponseEntity<>(brandsDisplay, HttpStatus.OK);
|
438 |
return new ResponseEntity<>(brandsDisplay, HttpStatus.OK);
|
| 434 |
}
|
439 |
}
|
| 435 |
|
440 |
|
| - |
|
441 |
@RequestMapping(value = "/fofo/brandCatalog", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| - |
|
442 |
public ResponseEntity<?> getBrands(HttpServletRequest request,
|
| - |
|
443 |
@RequestParam(required = false, defaultValue = "0") int categoryId) throws Exception {
|
| - |
|
444 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| - |
|
445 |
logger.info("userInfo [{}]", userInfo);
|
| - |
|
446 |
|
| - |
|
447 |
List<BrandCatalog> brandsDisplay = brandsService.getBrands(userInfo.getRetailerId(), userInfo.getEmail(),
|
| - |
|
448 |
categoryId);
|
| - |
|
449 |
return new ResponseEntity<>(brandsDisplay, HttpStatus.OK);
|
| - |
|
450 |
}
|
| - |
|
451 |
|
| 436 |
@RequestMapping(value = "/fofo/accessory/all-categories", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
452 |
@RequestMapping(value = "/fofo/accessory/all-categories", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 437 |
public ResponseEntity<?> getSubCategoriesToDisplay(HttpServletRequest request) throws Exception {
|
453 |
public ResponseEntity<?> getSubCategoriesToDisplay(HttpServletRequest request) throws Exception {
|
| 438 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
454 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| 439 |
logger.info("userInfo [{}]", userInfo);
|
455 |
logger.info("userInfo [{}]", userInfo);
|
| 440 |
List<DBObject> subCategoriesDisplay = this.getSubCategoriesToDisplay();
|
456 |
List<DBObject> subCategoriesDisplay = this.getSubCategoriesToDisplay();
|
| Line 492... |
Line 508... |
| 492 |
public ResponseEntity<?> getSubcategoriesToDisplay() {
|
508 |
public ResponseEntity<?> getSubcategoriesToDisplay() {
|
| 493 |
return new ResponseEntity<>(mongoClient.getSubcategoriesToDisplay(), HttpStatus.OK);
|
509 |
return new ResponseEntity<>(mongoClient.getSubcategoriesToDisplay(), HttpStatus.OK);
|
| 494 |
}
|
510 |
}
|
| 495 |
|
511 |
|
| 496 |
@ApiImplicitParams({
|
512 |
@ApiImplicitParams({
|
| 497 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
513 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| 498 |
@RequestMapping(value = "/deals/skus/{skus}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
514 |
@RequestMapping(value = "/deals/skus/{skus}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 499 |
public ResponseEntity<?> getDealsBySkus(@PathVariable String skus) throws ProfitMandiBusinessException {
|
515 |
public ResponseEntity<?> getDealsBySkus(@PathVariable String skus) throws ProfitMandiBusinessException {
|
| 500 |
StringBuffer sb = new StringBuffer("/getDealsForNotification/");
|
516 |
StringBuffer sb = new StringBuffer("/getDealsForNotification/");
|
| 501 |
String uri = sb.append(skus).toString();
|
517 |
String uri = sb.append(skus).toString();
|
| 502 |
RestClient rc = new RestClient();
|
518 |
RestClient rc = new RestClient();
|
| Line 605... |
Line 621... |
| 605 |
}
|
621 |
}
|
| 606 |
fofoCatalogResponse.setBrand(doc.getJSONArray("brand_ss").getString(0));
|
622 |
fofoCatalogResponse.setBrand(doc.getJSONArray("brand_ss").getString(0));
|
| 607 |
if (doc.has("_childDocuments_")) {
|
623 |
if (doc.has("_childDocuments_")) {
|
| 608 |
String modelColorClass = "grey";
|
624 |
String modelColorClass = "grey";
|
| 609 |
FofoAvailabilityInfo fdiAnyColour = null;
|
625 |
FofoAvailabilityInfo fdiAnyColour = null;
|
| 610 |
//Iterating itemIds
|
626 |
// Iterating itemIds
|
| 611 |
for (int j = 0; j < doc.getJSONArray("_childDocuments_").length(); j++) {
|
627 |
for (int j = 0; j < doc.getJSONArray("_childDocuments_").length(); j++) {
|
| 612 |
PriceCircularItemModel priceCircularItemModel = priceCircularItemModelMap
|
628 |
PriceCircularItemModel priceCircularItemModel = priceCircularItemModelMap
|
| 613 |
.get(fofoCatalogResponse.getCatalogId());
|
629 |
.get(fofoCatalogResponse.getCatalogId());
|
| 614 |
JSONObject childItem = doc.getJSONArray("_childDocuments_").getJSONObject(j);
|
630 |
JSONObject childItem = doc.getJSONArray("_childDocuments_").getJSONObject(j);
|
| 615 |
int itemId = childItem.getInt("itemId_i");
|
631 |
int itemId = childItem.getInt("itemId_i");
|
| 616 |
float sellingPrice = (float) childItem.getDouble("sellingPrice_f");
|
632 |
float sellingPrice = (float) childItem.getDouble("sellingPrice_f");
|
| 617 |
if (!fofoAvailabilityInfoMap.containsKey(itemId)) {
|
633 |
if (!fofoAvailabilityInfoMap.containsKey(itemId)) {
|
| 618 |
FofoAvailabilityInfo fdi = new FofoAvailabilityInfo();
|
634 |
FofoAvailabilityInfo fdi = new FofoAvailabilityInfo();
|
| 619 |
List<SaholicCISTable> currentAvailability = saholicCISTableRepository.selectByItemWarehouse(itemId, warehouseId);
|
635 |
List<SaholicCISTable> currentAvailability = saholicCISTableRepository
|
| - |
|
636 |
.selectByItemWarehouse(itemId, warehouseId);
|
| 620 |
List<SaholicPOItem> poItemAvailability = null;
|
637 |
List<SaholicPOItem> poItemAvailability = null;
|
| 621 |
if (poItemAvailabilityMap != null) {
|
638 |
if (poItemAvailabilityMap != null) {
|
| 622 |
poItemAvailability = poItemAvailabilityMap.get(itemId);
|
639 |
poItemAvailability = poItemAvailabilityMap.get(itemId);
|
| 623 |
}
|
640 |
}
|
| 624 |
fdi.setNlc(priceCircularItemModel == null ? 0 : priceCircularItemModel.getNetPrice());
|
641 |
fdi.setNlc(priceCircularItemModel == null ? 0 : priceCircularItemModel.getNetPrice());
|
| Line 641... |
Line 658... |
| 641 |
saholicCISTable.setReserved(0);
|
658 |
saholicCISTable.setReserved(0);
|
| 642 |
saholicCISTable.setItemId(itemId);
|
659 |
saholicCISTable.setItemId(itemId);
|
| 643 |
saholicCISTable.setWarehouseId(warehouseId);
|
660 |
saholicCISTable.setWarehouseId(warehouseId);
|
| 644 |
saholicCISTable.setPopendingQty(saholicPOItem.getUnfulfilledQty());
|
661 |
saholicCISTable.setPopendingQty(saholicPOItem.getUnfulfilledQty());
|
| 645 |
saholicCISTable.setWarehouseFrom(saholicPOItem.getWarehouseFrom());
|
662 |
saholicCISTable.setWarehouseFrom(saholicPOItem.getWarehouseFrom());
|
| 646 |
saholicCISTable.setWarehouseName(ProfitMandiConstants.WAREHOUSE_MAP
|
663 |
saholicCISTable.setWarehouseName(
|
| 647 |
.get(saholicPOItem.getWarehouseFrom()));
|
664 |
ProfitMandiConstants.WAREHOUSE_MAP.get(saholicPOItem.getWarehouseFrom()));
|
| 648 |
map.put(saholicPOItem.getWarehouseFrom(), saholicCISTable);
|
665 |
map.put(saholicPOItem.getWarehouseFrom(), saholicCISTable);
|
| 649 |
}
|
666 |
}
|
| 650 |
}
|
667 |
}
|
| 651 |
}
|
668 |
}
|
| 652 |
fdi.setSaholicCISTableList(new ArrayList<>(map.values()));
|
669 |
fdi.setSaholicCISTableList(new ArrayList<>(map.values()));
|
| Line 659... |
Line 676... |
| 659 |
} else if (poItemAvailability != null && poItemAvailability.stream()
|
676 |
} else if (poItemAvailability != null && poItemAvailability.stream()
|
| 660 |
.collect(Collectors.summingInt(SaholicPOItem::getUnfulfilledQty)) > 0) {
|
677 |
.collect(Collectors.summingInt(SaholicPOItem::getUnfulfilledQty)) > 0) {
|
| 661 |
if (currentAvailability != null && poItemAvailability.stream()
|
678 |
if (currentAvailability != null && poItemAvailability.stream()
|
| 662 |
.collect(Collectors.summingInt(SaholicPOItem::getUnfulfilledQty))
|
679 |
.collect(Collectors.summingInt(SaholicPOItem::getUnfulfilledQty))
|
| 663 |
+ currentAvailability.stream()
|
680 |
+ currentAvailability.stream()
|
| 664 |
.collect(Collectors.summingInt(SaholicCISTable::getNetAvailability)) <= 0) {
|
681 |
.collect(Collectors.summingInt(SaholicCISTable::getNetAvailability)) <= 0) {
|
| 665 |
poColor = "grey";
|
682 |
poColor = "grey";
|
| 666 |
} else {
|
683 |
} else {
|
| 667 |
poColor = "yellow";
|
684 |
poColor = "yellow";
|
| 668 |
if (modelColorClass != "green") {
|
685 |
if (modelColorClass != "green") {
|
| 669 |
modelColorClass = poColor;
|
686 |
modelColorClass = poColor;
|
| Line 749... |
Line 766... |
| 749 |
return dealResponse;
|
766 |
return dealResponse;
|
| 750 |
|
767 |
|
| 751 |
}
|
768 |
}
|
| 752 |
|
769 |
|
| 753 |
private List<FofoCatalogResponse> getCatalogSingleSkuResponse(JSONArray docs, Map<Integer, Integer> itemFilter,
|
770 |
private List<FofoCatalogResponse> getCatalogSingleSkuResponse(JSONArray docs, Map<Integer, Integer> itemFilter,
|
| 754 |
boolean hotDeal) throws ProfitMandiBusinessException {
|
771 |
boolean hotDeal) throws ProfitMandiBusinessException {
|
| 755 |
Map<Integer, TagListing> itemTagListingMap = null;
|
772 |
Map<Integer, TagListing> itemTagListingMap = null;
|
| 756 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
773 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
| 757 |
List<Integer> tagIds = Arrays.asList(4);
|
774 |
List<Integer> tagIds = Arrays.asList(4);
|
| 758 |
|
775 |
|
| 759 |
itemTagListingMap = tagListingRepository.selectByItemIdsAndTagIds(itemFilter.keySet(), new HashSet<>(tagIds))
|
776 |
itemTagListingMap = tagListingRepository.selectByItemIdsAndTagIds(itemFilter.keySet(), new HashSet<>(tagIds))
|