| Line 786... |
Line 786... |
| 786 |
@Autowired
|
786 |
@Autowired
|
| 787 |
private SaholicCISTableRepository saholicCISTableRepository;
|
787 |
private SaholicCISTableRepository saholicCISTableRepository;
|
| 788 |
|
788 |
|
| 789 |
private List<FofoCatalogResponse> getCatalogResponse(JSONArray docs, boolean hotDeal, int fofoId) throws
|
789 |
private List<FofoCatalogResponse> getCatalogResponse(JSONArray docs, boolean hotDeal, int fofoId) throws
|
| 790 |
Exception {
|
790 |
Exception {
|
| 791 |
logger.info("getCatalogResponse docs start: {}",docs);
|
- |
|
| 792 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
791 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
| 793 |
List<Integer> tagIds = Arrays.asList(4);
|
792 |
List<Integer> tagIds = Arrays.asList(4);
|
| 794 |
List<Integer> itemIds = new ArrayList<>();
|
793 |
List<Integer> itemIds = new ArrayList<>();
|
| 795 |
if (docs.length() > 0) {
|
794 |
if (docs.length() > 0) {
|
| 796 |
for (int i = 0; i < docs.length(); i++) {
|
795 |
for (int i = 0; i < docs.length(); i++) {
|
| 797 |
JSONObject doc = docs.getJSONObject(i);
|
796 |
JSONObject doc = docs.getJSONObject(i);
|
| 798 |
logger.info("getCatalogResponse doc 1: {}",doc);
|
- |
|
| 799 |
if (doc.has("_childDocuments_")) {
|
797 |
if (doc.has("_childDocuments_")) {
|
| 800 |
for (int j = 0; j < doc.getJSONArray("_childDocuments_").length(); j++) {
|
798 |
for (int j = 0; j < doc.getJSONArray("_childDocuments_").length(); j++) {
|
| 801 |
JSONObject childItem = doc.getJSONArray("_childDocuments_").getJSONObject(j);
|
799 |
JSONObject childItem = doc.getJSONArray("_childDocuments_").getJSONObject(j);
|
| 802 |
logger.info("childItem doc 1: {}",childItem);
|
- |
|
| 803 |
int itemId = childItem.getInt("itemId_i");
|
800 |
int itemId = childItem.getInt("itemId_i");
|
| 804 |
itemIds.add(itemId);
|
801 |
itemIds.add(itemId);
|
| 805 |
}
|
802 |
}
|
| 806 |
}
|
803 |
}
|
| 807 |
}
|
804 |
}
|
| 808 |
if (itemIds.size() == 0) {
|
805 |
if (itemIds.size() == 0) {
|
| 809 |
logger.info("itemIds.size doc: {}",itemIds.size());
|
- |
|
| 810 |
return dealResponse;
|
806 |
return dealResponse;
|
| 811 |
}
|
807 |
}
|
| 812 |
}
|
808 |
}
|
| 813 |
// get warehouse Id
|
809 |
// get warehouse Id
|
| 814 |
int warehouseId = fofoStoreRepository.selectByRetailerId(fofoId).getWarehouseId();
|
810 |
int warehouseId = fofoStoreRepository.selectByRetailerId(fofoId).getWarehouseId();
|
| Line 839... |
Line 835... |
| 839 |
|
835 |
|
| 840 |
if (!catalogFavourites.isEmpty()) {
|
836 |
if (!catalogFavourites.isEmpty()) {
|
| 841 |
catalogFavourites.stream().collect(Collectors.toMap(x -> x.getCatalogId(), x -> x));
|
837 |
catalogFavourites.stream().collect(Collectors.toMap(x -> x.getCatalogId(), x -> x));
|
| 842 |
}*/
|
838 |
}*/
|
| 843 |
|
839 |
|
| 844 |
logger.info("getCatalogResponse docs: {}",docs);
|
- |
|
| 845 |
|
- |
|
| 846 |
for (int i = 0; i < docs.length(); i++) {
|
840 |
for (int i = 0; i < docs.length(); i++) {
|
| 847 |
Map<Integer, FofoAvailabilityInfo> fofoAvailabilityInfoMap = new HashMap<>();
|
841 |
Map<Integer, FofoAvailabilityInfo> fofoAvailabilityInfoMap = new HashMap<>();
|
| 848 |
JSONObject doc = docs.getJSONObject(i);
|
842 |
JSONObject doc = docs.getJSONObject(i);
|
| 849 |
FofoCatalogResponse fofoCatalogResponse = new FofoCatalogResponse();
|
843 |
FofoCatalogResponse fofoCatalogResponse = new FofoCatalogResponse();
|
| 850 |
fofoCatalogResponse.setCatalogId(doc.getInt("catalogId_i"));
|
844 |
fofoCatalogResponse.setCatalogId(doc.getInt("catalogId_i"));
|
| Line 1013... |
Line 1007... |
| 1013 |
if (fdiAnyColour != null) {
|
1007 |
if (fdiAnyColour != null) {
|
| 1014 |
fdiAnyColour.setColorClass(modelColorClass);
|
1008 |
fdiAnyColour.setColorClass(modelColorClass);
|
| 1015 |
}
|
1009 |
}
|
| 1016 |
fofoCatalogResponse.setInStock(!modelColorClass.equals("grey"));
|
1010 |
fofoCatalogResponse.setInStock(!modelColorClass.equals("grey"));
|
| 1017 |
}
|
1011 |
}
|
| 1018 |
logger.info("fofoCatalogResponse: {}",fofoCatalogResponse);
|
- |
|
| 1019 |
if (fofoAvailabilityInfoMap.values().size() > 0) {
|
1012 |
if (fofoAvailabilityInfoMap.values().size() > 0) {
|
| 1020 |
List<FofoAvailabilityInfo> availabilityList = fofoAvailabilityInfoMap.values().stream().sorted(Comparator.comparing(FofoAvailabilityInfo::getAvailability).reversed()).collect(Collectors.toList());
|
1013 |
List<FofoAvailabilityInfo> availabilityList = fofoAvailabilityInfoMap.values().stream().sorted(Comparator.comparing(FofoAvailabilityInfo::getAvailability).reversed()).collect(Collectors.toList());
|
| 1021 |
fofoCatalogResponse.setItems(availabilityList);
|
1014 |
fofoCatalogResponse.setItems(availabilityList);
|
| 1022 |
if (priceCircularItemModelMap.containsKey(fofoCatalogResponse.getCatalogId())) {
|
1015 |
if (priceCircularItemModelMap.containsKey(fofoCatalogResponse.getCatalogId())) {
|
| 1023 |
PriceCircularItemModelNew priceCircularItemModel = priceCircularItemModelMap.get(fofoCatalogResponse.getCatalogId());
|
1016 |
PriceCircularItemModelNew priceCircularItemModel = priceCircularItemModelMap.get(fofoCatalogResponse.getCatalogId());
|
| Line 1040... |
Line 1033... |
| 1040 |
fofoCatalogResponse.setPriceCircularItemModel(priceCircularItemModel);
|
1033 |
fofoCatalogResponse.setPriceCircularItemModel(priceCircularItemModel);
|
| 1041 |
}
|
1034 |
}
|
| 1042 |
dealResponse.add(fofoCatalogResponse);
|
1035 |
dealResponse.add(fofoCatalogResponse);
|
| 1043 |
}
|
1036 |
}
|
| 1044 |
}
|
1037 |
}
|
| 1045 |
logger.info("dealResponse: {}",dealResponse);
|
- |
|
| 1046 |
return dealResponse;
|
1038 |
return dealResponse;
|
| 1047 |
|
1039 |
|
| 1048 |
}
|
1040 |
}
|
| 1049 |
|
1041 |
|
| 1050 |
private List<FofoCatalogResponse> getCatalogSingleSkuResponse(JSONArray
|
1042 |
private List<FofoCatalogResponse> getCatalogSingleSkuResponse(JSONArray
|