| Line 35... |
Line 35... |
| 35 |
import com.spice.profitmandi.dao.repository.fofo.SuggestedPoRepository;
|
35 |
import com.spice.profitmandi.dao.repository.fofo.SuggestedPoRepository;
|
| 36 |
import com.spice.profitmandi.dao.repository.inventory.SaholicCISTableRepository;
|
36 |
import com.spice.profitmandi.dao.repository.inventory.SaholicCISTableRepository;
|
| 37 |
import com.spice.profitmandi.dao.repository.onboarding.BrandCommitRepository;
|
37 |
import com.spice.profitmandi.dao.repository.onboarding.BrandCommitRepository;
|
| 38 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
38 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 39 |
import com.spice.profitmandi.service.catalog.BrandsService;
|
39 |
import com.spice.profitmandi.service.catalog.BrandsService;
|
| - |
|
40 |
import com.spice.profitmandi.service.integrations.pinelabs.PinelabsAffordabilityService;
|
| - |
|
41 |
import com.spice.profitmandi.service.integrations.pinelabs.dto.OfferDiscoveryRequest;
|
| - |
|
42 |
import com.spice.profitmandi.service.integrations.pinelabs.dto.OfferDiscoveryResponse;
|
| 40 |
import com.spice.profitmandi.service.inventory.*;
|
43 |
import com.spice.profitmandi.service.inventory.*;
|
| 41 |
import com.spice.profitmandi.service.pricecircular.PriceCircularItemModelNew;
|
44 |
import com.spice.profitmandi.service.pricecircular.PriceCircularItemModelNew;
|
| 42 |
import com.spice.profitmandi.service.pricecircular.PriceCircularModel;
|
45 |
import com.spice.profitmandi.service.pricecircular.PriceCircularModel;
|
| 43 |
import com.spice.profitmandi.service.pricecircular.PriceCircularService;
|
46 |
import com.spice.profitmandi.service.pricecircular.PriceCircularService;
|
| 44 |
import com.spice.profitmandi.service.pricing.PricingService;
|
47 |
import com.spice.profitmandi.service.pricing.PricingService;
|
| Line 96... |
Line 99... |
| 96 |
|
99 |
|
| 97 |
@Autowired
|
100 |
@Autowired
|
| 98 |
com.spice.profitmandi.web.services.SolrService webSolrService;
|
101 |
com.spice.profitmandi.web.services.SolrService webSolrService;
|
| 99 |
|
102 |
|
| 100 |
@Autowired
|
103 |
@Autowired
|
| 101 |
InventoryService inventoryService;
|
104 |
PinelabsAffordabilityService pinelabsAffordabilityService;
|
| 102 |
|
105 |
|
| 103 |
// This is now unused as we are not supporting multiple companies.
|
106 |
// This is now unused as we are not supporting multiple companies.
|
| 104 |
@Value("${gadgetCops.invoice.cc}")
|
107 |
@Value("${gadgetCops.invoice.cc}")
|
| 105 |
private String[] ccGadgetCopInvoiceTo;
|
108 |
private String[] ccGadgetCopInvoiceTo;
|
| 106 |
|
109 |
|
| Line 351... |
Line 354... |
| 351 |
}
|
354 |
}
|
| 352 |
|
355 |
|
| 353 |
@ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
356 |
@ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
| 354 |
@RequestMapping(value = "/fofo", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
357 |
@RequestMapping(value = "/fofo", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 355 |
public ResponseEntity<?> getFofo(HttpServletRequest request, @RequestParam(value = "categoryId", required = false, defaultValue = "3") String categoryId, @RequestParam(value = "offset") int offset,
|
358 |
public ResponseEntity<?> getFofo(HttpServletRequest request, @RequestParam(value = "categoryId", required = false, defaultValue = "3") String categoryId, @RequestParam(value = "offset") int offset,
|
| 356 |
@RequestParam(value = "limit") int limit, @RequestParam(value = "sort", required = false) String sort, @RequestParam(value = "brand", required = false) String brand, @RequestParam(value = "subCategoryId", required = false) int subCategoryId, @RequestParam(value = "q", required = false) String queryTerm, @RequestParam(value = "hotDeal", required = false) boolean hotDeal, @RequestParam(value = "endPoint", required = false) String endPoint,@RequestParam(value = "group", required = false) boolean group) throws Throwable {
|
359 |
@RequestParam(value = "limit") int limit, @RequestParam(value = "sort", required = false) String sort, @RequestParam(value = "brand", required = false) String brand, @RequestParam(value = "subCategoryId", required = false) int subCategoryId, @RequestParam(value = "q", required = false) String queryTerm, @RequestParam(value = "hotDeal", required = false) boolean hotDeal, @RequestParam(value = "endPoint", required = false) String endPoint,@RequestParam(value = "group", required = false) boolean group) throws Throwable {
|
| 357 |
List<FofoCatalogResponse> dealResponse;
|
360 |
List<FofoCatalogResponse> dealResponse;
|
| 358 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
361 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| 359 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(userInfo.getRetailerId());
|
362 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(userInfo.getRetailerId());
|
| 360 |
sort = "w" + fs.getWarehouseId() + "_i desc";
|
363 |
sort = "w" + fs.getWarehouseId() + "_i desc";
|
| 361 |
|
364 |
|
| Line 764... |
Line 767... |
| 764 |
webListing.setFofoCatalogResponses(getDealResponses(userInfo, fs, webListing, 0, 20));
|
767 |
webListing.setFofoCatalogResponses(getDealResponses(userInfo, fs, webListing, 0, 20));
|
| 765 |
}
|
768 |
}
|
| 766 |
return responseSender.ok(webListings);
|
769 |
return responseSender.ok(webListings);
|
| 767 |
}
|
770 |
}
|
| 768 |
|
771 |
|
| 769 |
private List<FofoCatalogResponse> getDealResponses(UserInfo userInfo, FofoStore fs, WebListing webListing, int offset,
|
772 |
private List<FofoCatalogResponse> getDealResponses(UserInfo userInfo, FofoStore fs, WebListing webListing, int offset, int limit) throws Exception {
|
| 770 |
int limit) throws Exception {
|
- |
|
| 771 |
|
773 |
|
| 772 |
Map<String, String> params = new HashMap<>();
|
774 |
Map<String, String> params = new HashMap<>();
|
| 773 |
List<String> mandatoryQ = new ArrayList<>();
|
775 |
List<String> mandatoryQ = new ArrayList<>();
|
| 774 |
|
776 |
|
| 775 |
params.put("sort", "w" + fs.getWarehouseId() + "_i desc");
|
777 |
params.put("sort", "w" + fs.getWarehouseId() + "_i desc");
|
| Line 817... |
Line 819... |
| 817 |
}
|
819 |
}
|
| 818 |
|
820 |
|
| 819 |
@Autowired
|
821 |
@Autowired
|
| 820 |
private SaholicCISTableRepository saholicCISTableRepository;
|
822 |
private SaholicCISTableRepository saholicCISTableRepository;
|
| 821 |
|
823 |
|
| 822 |
private List<FofoCatalogResponse> getCatalogResponse(JSONArray docs, boolean hotDeal, int fofoId) throws
|
824 |
private List<FofoCatalogResponse> getCatalogResponse(JSONArray docs, boolean hotDeal, int fofoId) throws Exception {
|
| 823 |
Exception {
|
- |
|
| 824 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
825 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
| 825 |
List<Integer> tagIds = Arrays.asList(4);
|
826 |
List<Integer> tagIds = Arrays.asList(4);
|
| 826 |
List<Integer> itemIds = new ArrayList<>();
|
827 |
List<Integer> itemIds = new ArrayList<>();
|
| 827 |
Map<Integer, Integer> partnerStockAvailabilityMap = null;
|
828 |
Map<Integer, Integer> partnerStockAvailabilityMap = null;
|
| 828 |
if (docs.length() > 0) {
|
829 |
if (docs.length() > 0) {
|
| Line 907... |
Line 908... |
| 907 |
fofoCatalogResponse.setTitle(doc.getString("title_s"));
|
908 |
fofoCatalogResponse.setTitle(doc.getString("title_s"));
|
| 908 |
fofoCatalogResponse.setSuperCatalogTitle(doc.getString("superCatalog_s"));
|
909 |
fofoCatalogResponse.setSuperCatalogTitle(doc.getString("superCatalog_s"));
|
| 909 |
fofoCatalogResponse.setSuperCatalogId(doc.getInt("superCatalog_i"));
|
910 |
fofoCatalogResponse.setSuperCatalogId(doc.getInt("superCatalog_i"));
|
| 910 |
fofoCatalogResponse.setSuperCatalogVariants(doc.getString("superCatalogVariants_s"));
|
911 |
fofoCatalogResponse.setSuperCatalogVariants(doc.getString("superCatalogVariants_s"));
|
| 911 |
|
912 |
|
| 912 |
if (favouriteCatalogIds.contains(fofoCatalogResponse.getCatalogId())) {
|
- |
|
| 913 |
fofoCatalogResponse.setFavourite(true);
|
913 |
// optional, since default is false
|
| 914 |
} else {
|
- |
|
| 915 |
fofoCatalogResponse.setFavourite(false); // optional, since default is false
|
914 |
fofoCatalogResponse.setFavourite(favouriteCatalogIds.contains(fofoCatalogResponse.getCatalogId()));
|
| 916 |
}
|
- |
|
| 917 |
List<WebOffer> webOffers = webOffersMap.get(fofoCatalogResponse.getCatalogId());
|
915 |
List<WebOffer> webOffers = webOffersMap.get(fofoCatalogResponse.getCatalogId());
|
| 918 |
|
916 |
|
| 919 |
//logger.info("webOffers {}", webOffers);
|
917 |
//logger.info("webOffers {}", webOffers);
|
| 920 |
if (webOffers != null && webOffers.size() > 0) {
|
918 |
if (webOffers != null && webOffers.size() > 0) {
|
| 921 |
fofoCatalogResponse.setWebOffers(webOffers);
|
919 |
fofoCatalogResponse.setWebOffers(webOffers);
|
| Line 1196... |
Line 1194... |
| 1196 |
@GetMapping(value = "/partner/wodCompleteBrands", produces = MediaType.APPLICATION_JSON_VALUE)
|
1194 |
@GetMapping(value = "/partner/wodCompleteBrands", produces = MediaType.APPLICATION_JSON_VALUE)
|
| 1197 |
public ResponseEntity<?> getWodcompletBrands(HttpServletRequest request) throws Exception {
|
1195 |
public ResponseEntity<?> getWodcompletBrands(HttpServletRequest request) throws Exception {
|
| 1198 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
1196 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| 1199 |
BrandAndAddToCartEligibleModel brandAndAddToCartEligibleModel = brandsService.wodcompletBrands(userInfo.getRetailerId());
|
1197 |
BrandAndAddToCartEligibleModel brandAndAddToCartEligibleModel = brandsService.wodcompletBrands(userInfo.getRetailerId());
|
| 1200 |
return responseSender.ok(brandAndAddToCartEligibleModel);
|
1198 |
return responseSender.ok(brandAndAddToCartEligibleModel);
|
| - |
|
1199 |
}
|
| 1201 |
|
1200 |
|
| - |
|
1201 |
@RequestMapping(value = "/pinelabs/offers", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
| - |
|
1202 |
public ResponseEntity<?> getPineLabsOffers(@RequestBody OfferDiscoveryRequest offerDiscoveryRequest) {
|
| - |
|
1203 |
logger.info("pinelabs offers {}", offerDiscoveryRequest);
|
| - |
|
1204 |
OfferDiscoveryResponse pineLabsOffers = pinelabsAffordabilityService.discoverOffers(offerDiscoveryRequest);
|
| - |
|
1205 |
logger.info("pinelabs offers response {}", pineLabsOffers);
|
| - |
|
1206 |
return responseSender.ok(pineLabsOffers);
|
| 1202 |
}
|
1207 |
}
|
| 1203 |
|
1208 |
|
| 1204 |
}
|
1209 |
}
|
| 1205 |
|
1210 |
|