| Line 8... |
Line 8... |
| 8 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
8 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 9 |
import com.spice.profitmandi.common.model.*;
|
9 |
import com.spice.profitmandi.common.model.*;
|
| 10 |
import com.spice.profitmandi.dao.entity.affiliate.AffiliateEarnings;
|
10 |
import com.spice.profitmandi.dao.entity.affiliate.AffiliateEarnings;
|
| 11 |
import com.spice.profitmandi.dao.entity.affiliate.AffiliateProduct;
|
11 |
import com.spice.profitmandi.dao.entity.affiliate.AffiliateProduct;
|
| 12 |
import com.spice.profitmandi.dao.entity.catalog.LiquidationDetail;
|
12 |
import com.spice.profitmandi.dao.entity.catalog.LiquidationDetail;
|
| - |
|
13 |
import com.spice.profitmandi.dao.entity.catalog.SuperCatalogMapping;
|
| 13 |
import com.spice.profitmandi.common.solr.SolrService;
|
14 |
import com.spice.profitmandi.common.solr.SolrService;
|
| 14 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
15 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
| 15 |
import com.spice.profitmandi.common.util.PdfUtils;
|
16 |
import com.spice.profitmandi.common.util.PdfUtils;
|
| 16 |
import com.spice.profitmandi.common.util.Utils;
|
17 |
import com.spice.profitmandi.common.util.Utils;
|
| 17 |
import com.spice.profitmandi.common.web.client.RestClient;
|
18 |
import com.spice.profitmandi.common.web.client.RestClient;
|
| Line 32... |
Line 33... |
| 32 |
import com.spice.profitmandi.dao.model.pendingOrder.PendingOrderDetail;
|
33 |
import com.spice.profitmandi.dao.model.pendingOrder.PendingOrderDetail;
|
| 33 |
import com.spice.profitmandi.dao.repository.affiliateLink.AffiliateLinkRepository;
|
34 |
import com.spice.profitmandi.dao.repository.affiliateLink.AffiliateLinkRepository;
|
| 34 |
import com.spice.profitmandi.dao.repository.catalog.BidRepository;
|
35 |
import com.spice.profitmandi.dao.repository.catalog.BidRepository;
|
| 35 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
36 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| 36 |
import com.spice.profitmandi.dao.repository.catalog.LiquidationRepository;
|
37 |
import com.spice.profitmandi.dao.repository.catalog.LiquidationRepository;
|
| - |
|
38 |
import com.spice.profitmandi.dao.repository.catalog.SuperCatalogMappingRepository;
|
| 37 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
39 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
| 38 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
40 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 39 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
41 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
| 40 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
42 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
| 41 |
import com.spice.profitmandi.dao.repository.inventory.ItemAvailabilityCacheRepository;
|
43 |
import com.spice.profitmandi.dao.repository.inventory.ItemAvailabilityCacheRepository;
|
| Line 51... |
Line 53... |
| 51 |
import com.spice.profitmandi.service.NotificationService;
|
53 |
import com.spice.profitmandi.service.NotificationService;
|
| 52 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
54 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 53 |
import com.spice.profitmandi.service.catalog.BiddingModel;
|
55 |
import com.spice.profitmandi.service.catalog.BiddingModel;
|
| 54 |
import com.spice.profitmandi.service.integrations.zest.InsuranceService;
|
56 |
import com.spice.profitmandi.service.integrations.zest.InsuranceService;
|
| 55 |
import com.spice.profitmandi.service.integrations.zest.MobileInsurancePlan;
|
57 |
import com.spice.profitmandi.service.integrations.zest.MobileInsurancePlan;
|
| - |
|
58 |
import com.spice.profitmandi.service.catalog.SuperCatalogModel;
|
| 56 |
import com.spice.profitmandi.service.inventory.*;
|
59 |
import com.spice.profitmandi.service.inventory.*;
|
| 57 |
import com.spice.profitmandi.service.order.OrderService;
|
60 |
import com.spice.profitmandi.service.order.OrderService;
|
| 58 |
import com.spice.profitmandi.service.scheme.SchemeService;
|
61 |
import com.spice.profitmandi.service.scheme.SchemeService;
|
| 59 |
import com.spice.profitmandi.service.user.RetailerService;
|
62 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 60 |
import com.spice.profitmandi.dao.service.OtpProcessor;
|
63 |
import com.spice.profitmandi.dao.service.OtpProcessor;
|
| Line 62... |
Line 65... |
| 62 |
import com.spice.profitmandi.web.res.DealBrands;
|
65 |
import com.spice.profitmandi.web.res.DealBrands;
|
| 63 |
import com.spice.profitmandi.web.res.DealObjectResponse;
|
66 |
import com.spice.profitmandi.web.res.DealObjectResponse;
|
| 64 |
import com.spice.profitmandi.web.res.DealsResponse;
|
67 |
import com.spice.profitmandi.web.res.DealsResponse;
|
| 65 |
import com.spice.profitmandi.web.res.ValidateCartResponse;
|
68 |
import com.spice.profitmandi.web.res.ValidateCartResponse;
|
| 66 |
import com.spice.profitmandi.web.services.PartnerIndexService;
|
69 |
import com.spice.profitmandi.web.services.PartnerIndexService;
|
| - |
|
70 |
import com.spice.profitmandi.service.tag.ItemTagModel;
|
| - |
|
71 |
import in.shop2020.model.v1.catalog.status;
|
| 67 |
import in.shop2020.model.v1.order.WalletReferenceType;
|
72 |
import in.shop2020.model.v1.order.WalletReferenceType;
|
| 68 |
import io.swagger.annotations.ApiImplicitParam;
|
73 |
import io.swagger.annotations.ApiImplicitParam;
|
| 69 |
import io.swagger.annotations.ApiImplicitParams;
|
74 |
import io.swagger.annotations.ApiImplicitParams;
|
| 70 |
import io.swagger.annotations.ApiOperation;
|
75 |
import io.swagger.annotations.ApiOperation;
|
| 71 |
import org.apache.commons.lang3.StringUtils;
|
76 |
import org.apache.commons.lang3.StringUtils;
|
| Line 179... |
Line 184... |
| 179 |
|
184 |
|
| 180 |
@Autowired
|
185 |
@Autowired
|
| 181 |
private SchemeService schemeService;
|
186 |
private SchemeService schemeService;
|
| 182 |
|
187 |
|
| 183 |
@Autowired
|
188 |
@Autowired
|
| - |
|
189 |
private SuperCatalogMappingRepository superCatalogMappingRepository;
|
| - |
|
190 |
|
| - |
|
191 |
@Autowired
|
| - |
|
192 |
private Mongo mongoClient;
|
| - |
|
193 |
|
| - |
|
194 |
@Autowired
|
| 184 |
private UserRepository userRepository;
|
195 |
private UserRepository userRepository;
|
| 185 |
|
196 |
|
| 186 |
@Autowired
|
197 |
@Autowired
|
| 187 |
private ItemAvailabilityCacheRepository itemAvailabilityCacheRepository;
|
198 |
private ItemAvailabilityCacheRepository itemAvailabilityCacheRepository;
|
| 188 |
|
199 |
|
| Line 1051... |
Line 1062... |
| 1051 |
@RequestMapping(value = "/store/partnerStock", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
1062 |
@RequestMapping(value = "/store/partnerStock", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 1052 |
public ResponseEntity<?> partnerStock(HttpServletRequest request, @RequestParam(required = false, defaultValue = "3") String categoryId, @RequestParam int offset,
|
1063 |
public ResponseEntity<?> partnerStock(HttpServletRequest request, @RequestParam(required = false, defaultValue = "3") String categoryId, @RequestParam int offset,
|
| 1053 |
@RequestParam int limit, @RequestParam(required = false) String sort, @RequestParam(required = false) String brand,
|
1064 |
@RequestParam int limit, @RequestParam(required = false) String sort, @RequestParam(required = false) String brand,
|
| 1054 |
@RequestParam(value = "subCategoryId", required = false) int subCategoryId, @RequestParam(required = false) String queryTerm,
|
1065 |
@RequestParam(value = "subCategoryId", required = false) int subCategoryId, @RequestParam(required = false) String queryTerm,
|
| 1055 |
@RequestParam(required = false) String listing, @RequestParam(required = false, defaultValue = "true") boolean partnerStockOnly) throws Throwable {
|
1066 |
@RequestParam(required = false) String listing, @RequestParam(required = false, defaultValue = "true") boolean partnerStockOnly) throws Throwable {
|
| 1056 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
- |
|
| 1057 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
1067 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| 1058 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(userInfo.getRetailerId());
|
- |
|
| 1059 |
sort = "w" + fs.getWarehouseId() + "_i desc";
|
1068 |
int dbCategoryId = mapFrontendCategoryToDb(categoryId);
|
| 1060 |
dealResponse = this.getCatalogResponse(
|
1069 |
List<FofoCatalogResponse> dealResponse = getCatalogResponseFromDb(
|
| 1061 |
commonSolrService.getSolrDocs(queryTerm, categoryId, offset, limit, sort, brand, subCategoryId, false, false,false), false, userInfo.getRetailerId());
|
1070 |
dbCategoryId, userInfo.getRetailerId(), offset, limit, brand, queryTerm, subCategoryId);
|
| 1062 |
return responseSender.ok(dealResponse);
|
1071 |
return responseSender.ok(dealResponse);
|
| 1063 |
}
|
1072 |
}
|
| 1064 |
|
1073 |
|
| - |
|
1074 |
private int mapFrontendCategoryToDb(String frontendCategoryId) {
|
| - |
|
1075 |
if ("3".equals(frontendCategoryId)) return 10006;
|
| - |
|
1076 |
try {
|
| - |
|
1077 |
return Integer.parseInt(frontendCategoryId);
|
| - |
|
1078 |
} catch (NumberFormatException e) {
|
| - |
|
1079 |
return 10006;
|
| - |
|
1080 |
}
|
| - |
|
1081 |
}
|
| - |
|
1082 |
|
| - |
|
1083 |
private List<FofoCatalogResponse> getCatalogResponseFromDb(int dbCategoryId, int fofoId, int offset, int limit,
|
| - |
|
1084 |
String brand, String queryTerm, int subCategoryId) throws ProfitMandiBusinessException {
|
| - |
|
1085 |
List<status> statuses = Arrays.asList(status.ACTIVE, status.PAUSED_BY_RISK, status.PARTIALLY_ACTIVE);
|
| - |
|
1086 |
List<ItemTagModel> itemTagModels = tagListingRepository.getItemTagByCategoryAndStatus(dbCategoryId, statuses);
|
| - |
|
1087 |
|
| - |
|
1088 |
List<String> excludeBrands = Arrays.asList("Dummy", "FOC HANDSET", "FOC", "Live Demo");
|
| - |
|
1089 |
|
| - |
|
1090 |
Map<Integer, List<ItemTagModel>> catalogGrouped = itemTagModels.stream()
|
| - |
|
1091 |
.filter(itm -> !excludeBrands.contains(itm.getItem().getBrand()))
|
| - |
|
1092 |
.filter(itm -> brand == null || brand.isEmpty() || itm.getItem().getBrand().equalsIgnoreCase(brand))
|
| - |
|
1093 |
.filter(itm -> queryTerm == null || queryTerm.isEmpty() || queryTerm.equals("null")
|
| - |
|
1094 |
|| matchesSearchQuery(itm.getItem(), queryTerm))
|
| - |
|
1095 |
.filter(itm -> subCategoryId == 0 || itm.getItem().getCategoryId() == subCategoryId)
|
| - |
|
1096 |
.collect(Collectors.groupingBy(itm -> itm.getItem().getCatalogItemId()));
|
| - |
|
1097 |
|
| - |
|
1098 |
if (catalogGrouped.isEmpty()) {
|
| - |
|
1099 |
return new ArrayList<>();
|
| - |
|
1100 |
}
|
| - |
|
1101 |
|
| - |
|
1102 |
Set<Integer> allItemIds = catalogGrouped.values().stream()
|
| - |
|
1103 |
.flatMap(List::stream)
|
| - |
|
1104 |
.map(itm -> itm.getItem().getId())
|
| - |
|
1105 |
.collect(Collectors.toSet());
|
| - |
|
1106 |
|
| - |
|
1107 |
Map<Integer, Integer> partnerStockMap = Collections.emptyMap();
|
| - |
|
1108 |
if (fofoId > 0) {
|
| - |
|
1109 |
partnerStockMap = currentInventorySnapshotRepository.selectItemsStock(fofoId).stream()
|
| - |
|
1110 |
.collect(Collectors.toMap(x -> x.getItemId(), x -> x.getAvailability(), (a, b) -> a));
|
| - |
|
1111 |
}
|
| - |
|
1112 |
|
| - |
|
1113 |
Map<Integer, Integer> warehouseStockMap = saholicInventoryService.getTotalAvailabilityByItemIds(new ArrayList<>(allItemIds));
|
| - |
|
1114 |
|
| - |
|
1115 |
Map<Integer, List<WebOffer>> webOfferMap = webOfferRepository.selectAllActiveOffers();
|
| - |
|
1116 |
|
| - |
|
1117 |
List<SuperCatalogModel> superCatalogModels = superCatalogMappingRepository.selectJoinedData();
|
| - |
|
1118 |
List<SuperCatalogMapping> superCatalogs = superCatalogMappingRepository.selectAll();
|
| - |
|
1119 |
|
| - |
|
1120 |
List<Integer> allCatalogIds = new ArrayList<>(catalogGrouped.keySet());
|
| - |
|
1121 |
|
| - |
|
1122 |
Map<Integer, Float> cashBackCache = fofoId > 0
|
| - |
|
1123 |
? schemeService.getCatalogSchemeCashBack(fofoId, allCatalogIds)
|
| - |
|
1124 |
: new HashMap<>();
|
| - |
|
1125 |
|
| - |
|
1126 |
Map<Long, ContentPojo> imageCache = mongoClient.getEntitiesByIds(
|
| - |
|
1127 |
allCatalogIds.stream().map(Integer::longValue).collect(Collectors.toList()));
|
| - |
|
1128 |
|
| - |
|
1129 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
| - |
|
1130 |
|
| - |
|
1131 |
for (Map.Entry<Integer, List<ItemTagModel>> entry : catalogGrouped.entrySet()) {
|
| - |
|
1132 |
int catalogId = entry.getKey();
|
| - |
|
1133 |
List<ItemTagModel> catalogItems = entry.getValue();
|
| - |
|
1134 |
Item firstItem = catalogItems.get(0).getItem();
|
| - |
|
1135 |
|
| - |
|
1136 |
FofoCatalogResponse ffdr = new FofoCatalogResponse();
|
| - |
|
1137 |
ffdr.setCatalogId(catalogId);
|
| - |
|
1138 |
|
| - |
|
1139 |
String title = Arrays.asList(firstItem.getBrand(), firstItem.getModelName(), firstItem.getModelNumber())
|
| - |
|
1140 |
.stream().filter(s -> s != null && !s.isEmpty()).collect(Collectors.joining(" "));
|
| - |
|
1141 |
ffdr.setTitle(title);
|
| - |
|
1142 |
ContentPojo cachedEntity = imageCache.get((long) catalogId);
|
| - |
|
1143 |
String imageUrl = cachedEntity != null ? cachedEntity.getDefaultImageUrl() : null;
|
| - |
|
1144 |
ffdr.setImageUrl(imageUrl != null ? imageUrl : "https://images.smartdukaan.com/uploads/campaigns/" + catalogId + ".jpg");
|
| - |
|
1145 |
ffdr.setBrand(firstItem.getBrand());
|
| - |
|
1146 |
ffdr.setIsSmartPhone(firstItem.isSmartPhone());
|
| - |
|
1147 |
ffdr.setFeature(null);
|
| - |
|
1148 |
|
| - |
|
1149 |
Optional<SuperCatalogModel> scMapping = superCatalogModels.stream()
|
| - |
|
1150 |
.filter(m -> m.getCatalogId() == catalogId).findFirst();
|
| - |
|
1151 |
if (scMapping.isPresent()) {
|
| - |
|
1152 |
ffdr.setSuperCatalogId(scMapping.get().getSuperCatalogId());
|
| - |
|
1153 |
ffdr.setSuperCatalogTitle(scMapping.get().getSuperCatalogName());
|
| - |
|
1154 |
ffdr.setSuperCatalogVariants(buildVariantsJson(superCatalogs, scMapping.get().getSuperCatalogId(), itemTagModels));
|
| - |
|
1155 |
} else {
|
| - |
|
1156 |
ffdr.setSuperCatalogId(0);
|
| - |
|
1157 |
ffdr.setSuperCatalogTitle(title);
|
| - |
|
1158 |
ffdr.setSuperCatalogVariants("[]");
|
| - |
|
1159 |
}
|
| - |
|
1160 |
|
| - |
|
1161 |
List<WebOffer> webOffers = webOfferMap.get(catalogId);
|
| - |
|
1162 |
if (webOffers != null && !webOffers.isEmpty()) {
|
| - |
|
1163 |
ffdr.setOffers(webOffers.stream().map(x -> x.getTitle()).collect(Collectors.toList()));
|
| - |
|
1164 |
}
|
| - |
|
1165 |
|
| - |
|
1166 |
Map<Integer, FofoAvailabilityInfo> fofoAvailabilityInfoMap = new HashMap<>();
|
| - |
|
1167 |
for (ItemTagModel itm : catalogItems) {
|
| - |
|
1168 |
Item item = itm.getItem();
|
| - |
|
1169 |
TagListing tl = itm.getTagListing();
|
| - |
|
1170 |
int itemId = item.getId();
|
| - |
|
1171 |
float sellingPrice = tl.getSellingPrice();
|
| - |
|
1172 |
|
| - |
|
1173 |
if (fofoAvailabilityInfoMap.containsKey(itemId)) {
|
| - |
|
1174 |
if (fofoAvailabilityInfoMap.get(itemId).getSellingPrice() > sellingPrice) {
|
| - |
|
1175 |
fofoAvailabilityInfoMap.get(itemId).setSellingPrice(sellingPrice);
|
| - |
|
1176 |
fofoAvailabilityInfoMap.get(itemId).setMop(tl.getMop());
|
| - |
|
1177 |
}
|
| - |
|
1178 |
} else {
|
| - |
|
1179 |
FofoAvailabilityInfo fdi = new FofoAvailabilityInfo();
|
| - |
|
1180 |
fdi.setSellingPrice(sellingPrice);
|
| - |
|
1181 |
fdi.setMrp(tl.getMrp());
|
| - |
|
1182 |
fdi.setMop(tl.getMop());
|
| - |
|
1183 |
fdi.setColor(item.getColor() != null ? item.getColor().replace("f_", "") : "");
|
| - |
|
1184 |
fdi.setTagId(tl.getTagId());
|
| - |
|
1185 |
fdi.setItem_id(itemId);
|
| - |
|
1186 |
fdi.setCatalog_id(catalogId);
|
| - |
|
1187 |
|
| - |
|
1188 |
Float cb = cashBackCache.get(catalogId);
|
| - |
|
1189 |
fdi.setCashback(cb != null ? cb : 0f);
|
| - |
|
1190 |
fdi.setMinBuyQuantity(1);
|
| - |
|
1191 |
|
| - |
|
1192 |
int partnerAvailability = partnerStockMap.getOrDefault(itemId, 0);
|
| - |
|
1193 |
int ourStockAvailability = Math.max(0, warehouseStockMap.getOrDefault(itemId, 0));
|
| - |
|
1194 |
fdi.setActive(partnerAvailability > 0);
|
| - |
|
1195 |
fdi.setPartnerAvailability(partnerAvailability);
|
| - |
|
1196 |
fdi.setAvailability(Math.min(5, ourStockAvailability + partnerAvailability));
|
| - |
|
1197 |
fdi.setQuantityStep(1);
|
| - |
|
1198 |
fdi.setMaxQuantity(fdi.getAvailability());
|
| - |
|
1199 |
|
| - |
|
1200 |
fofoAvailabilityInfoMap.put(itemId, fdi);
|
| - |
|
1201 |
}
|
| - |
|
1202 |
}
|
| - |
|
1203 |
|
| - |
|
1204 |
if (!fofoAvailabilityInfoMap.isEmpty()) {
|
| - |
|
1205 |
ffdr.setItems(fofoAvailabilityInfoMap.values().stream()
|
| - |
|
1206 |
.sorted(Comparator.comparing(FofoAvailabilityInfo::isActive, Comparator.reverseOrder())
|
| - |
|
1207 |
.thenComparingInt(y -> -y.getAvailability()))
|
| - |
|
1208 |
.collect(Collectors.toList()));
|
| - |
|
1209 |
dealResponse.add(ffdr);
|
| - |
|
1210 |
}
|
| - |
|
1211 |
}
|
| - |
|
1212 |
|
| - |
|
1213 |
dealResponse.sort(Comparator.comparing(FofoCatalogResponse::getItems,
|
| - |
|
1214 |
(s1, s2) -> (s2.get(0).isActive() ? 1 : 0) - (s1.get(0).isActive() ? 1 : 0))
|
| - |
|
1215 |
.thenComparing(FofoCatalogResponse::getItems,
|
| - |
|
1216 |
(x, y) -> y.get(0).getAvailability() - x.get(0).getAvailability()));
|
| - |
|
1217 |
|
| - |
|
1218 |
int start = Math.min(offset, dealResponse.size());
|
| - |
|
1219 |
int end = Math.min(offset + limit, dealResponse.size());
|
| - |
|
1220 |
return dealResponse.subList(start, end);
|
| - |
|
1221 |
}
|
| - |
|
1222 |
|
| - |
|
1223 |
private boolean matchesSearchQuery(Item item, String query) {
|
| - |
|
1224 |
String q = query.toLowerCase();
|
| - |
|
1225 |
String searchable = String.join(" ",
|
| - |
|
1226 |
item.getBrand() != null ? item.getBrand() : "",
|
| - |
|
1227 |
item.getModelName() != null ? item.getModelName() : "",
|
| - |
|
1228 |
item.getModelNumber() != null ? item.getModelNumber() : "",
|
| - |
|
1229 |
item.getColor() != null ? item.getColor() : "").toLowerCase();
|
| - |
|
1230 |
for (String term : q.split("\\s+")) {
|
| - |
|
1231 |
if (!searchable.contains(term)) return false;
|
| - |
|
1232 |
}
|
| - |
|
1233 |
return true;
|
| - |
|
1234 |
}
|
| - |
|
1235 |
|
| - |
|
1236 |
private String buildVariantsJson(List<SuperCatalogMapping> superCatalogs, int superCatalogId, List<ItemTagModel> itemTagModels) {
|
| - |
|
1237 |
List<Map<String, Object>> variantList = new ArrayList<>();
|
| - |
|
1238 |
List<SuperCatalogMapping> matchingVariants = superCatalogs.stream()
|
| - |
|
1239 |
.filter(m -> m.getSuperCatalogId() == superCatalogId)
|
| - |
|
1240 |
.collect(Collectors.toList());
|
| - |
|
1241 |
|
| - |
|
1242 |
for (SuperCatalogMapping variant : matchingVariants) {
|
| - |
|
1243 |
if (variant.getVariantName() == null) continue;
|
| - |
|
1244 |
boolean hasActiveTag = itemTagModels.stream()
|
| - |
|
1245 |
.anyMatch(tag -> tag.getItem().getCatalogItemId() == variant.getCatalogId() && tag.getTagListing().isActive());
|
| - |
|
1246 |
if (!hasActiveTag) continue;
|
| - |
|
1247 |
|
| - |
|
1248 |
ItemTagModel tagModel = itemTagModels.stream()
|
| - |
|
1249 |
.filter(tag -> tag.getItem().getCatalogItemId() == variant.getCatalogId())
|
| - |
|
1250 |
.findFirst().orElse(null);
|
| - |
|
1251 |
|
| - |
|
1252 |
Map<String, Object> variantObj = new HashMap<>();
|
| - |
|
1253 |
variantObj.put("catalogId", variant.getCatalogId());
|
| - |
|
1254 |
variantObj.put("variantName", variant.getVariantName());
|
| - |
|
1255 |
variantObj.put("mrp", tagModel != null ? tagModel.getTagListing().getMrp() : 0.0);
|
| - |
|
1256 |
variantObj.put("mop", tagModel != null ? tagModel.getTagListing().getMop() : 0.0);
|
| - |
|
1257 |
variantObj.put("sellingPrice", tagModel != null ? tagModel.getTagListing().getSellingPrice() : 0.0);
|
| - |
|
1258 |
variantList.add(variantObj);
|
| - |
|
1259 |
}
|
| - |
|
1260 |
|
| - |
|
1261 |
if (variantList.isEmpty()) return "[]";
|
| - |
|
1262 |
return new Gson().toJson(variantList);
|
| - |
|
1263 |
}
|
| - |
|
1264 |
|
| 1065 |
private List<FofoCatalogResponse> getCatalogResponse(JSONArray docs, boolean hotDeal, int fofoId) throws ProfitMandiBusinessException {
|
1265 |
private List<FofoCatalogResponse> getCatalogResponse(JSONArray docs, boolean hotDeal, int fofoId) throws ProfitMandiBusinessException {
|
| 1066 |
Map<Integer, Integer> ourItemAvailabilityMap = null;
|
1266 |
Map<Integer, Integer> ourItemAvailabilityMap = null;
|
| 1067 |
Map<Integer, Integer> partnerStockAvailabilityMap = null;
|
1267 |
Map<Integer, Integer> partnerStockAvailabilityMap = null;
|
| 1068 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
1268 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
| 1069 |
List<Integer> tagIds = Arrays.asList(4);
|
1269 |
List<Integer> tagIds = Arrays.asList(4);
|