| Line 8... |
Line 8... |
| 8 |
import com.google.gson.reflect.TypeToken;
|
8 |
import com.google.gson.reflect.TypeToken;
|
| 9 |
import com.mongodb.BasicDBObject;
|
9 |
import com.mongodb.BasicDBObject;
|
| 10 |
import com.mongodb.DBObject;
|
10 |
import com.mongodb.DBObject;
|
| 11 |
import com.spice.profitmandi.common.enumuration.SchemeType;
|
11 |
import com.spice.profitmandi.common.enumuration.SchemeType;
|
| 12 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
12 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| - |
|
13 |
import com.spice.profitmandi.common.model.BrandAndAddToCartEligibleModel;
|
| 13 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
14 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 14 |
import com.spice.profitmandi.common.model.UserInfo;
|
15 |
import com.spice.profitmandi.common.model.UserInfo;
|
| 15 |
import com.spice.profitmandi.common.solr.SolrService;
|
16 |
import com.spice.profitmandi.common.solr.SolrService;
|
| 16 |
import com.spice.profitmandi.common.web.client.RestClient;
|
17 |
import com.spice.profitmandi.common.web.client.RestClient;
|
| 17 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
18 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 18 |
import com.spice.profitmandi.dao.entity.catalog.*;
|
19 |
import com.spice.profitmandi.dao.entity.catalog.*;
|
| 19 |
import com.spice.profitmandi.dao.entity.dtr.WebListing;
|
20 |
import com.spice.profitmandi.dao.entity.dtr.WebListing;
|
| 20 |
import com.spice.profitmandi.dao.entity.dtr.WebOffer;
|
21 |
import com.spice.profitmandi.dao.entity.dtr.WebOffer;
|
| 21 |
import com.spice.profitmandi.dao.entity.fofo.CatalogFavourite;
|
- |
|
| 22 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
22 |
import com.spice.profitmandi.dao.entity.fofo.*;
|
| 23 |
import com.spice.profitmandi.dao.entity.fofo.SuggestedPo;
|
- |
|
| 24 |
import com.spice.profitmandi.dao.entity.fofo.SuggestedPoDetail;
|
- |
|
| 25 |
import com.spice.profitmandi.dao.entity.inventory.SaholicCISTable;
|
23 |
import com.spice.profitmandi.dao.entity.inventory.SaholicCISTable;
|
| 26 |
import com.spice.profitmandi.dao.entity.inventory.SaholicPOItem;
|
24 |
import com.spice.profitmandi.dao.entity.inventory.SaholicPOItem;
|
| 27 |
import com.spice.profitmandi.dao.entity.similarModel.SimilarModel;
|
- |
|
| 28 |
import com.spice.profitmandi.dao.enumuration.dtr.WebListingSource;
|
25 |
import com.spice.profitmandi.dao.enumuration.dtr.WebListingSource;
|
| 29 |
import com.spice.profitmandi.dao.enumuration.dtr.WebListingType;
|
26 |
import com.spice.profitmandi.dao.enumuration.dtr.WebListingType;
|
| 30 |
import com.spice.profitmandi.dao.model.AmountModel;
|
27 |
import com.spice.profitmandi.dao.model.AmountModel;
|
| 31 |
import com.spice.profitmandi.dao.model.CreateOfferRequest;
|
28 |
import com.spice.profitmandi.dao.model.CreateOfferRequest;
|
| 32 |
import com.spice.profitmandi.dao.model.UserCart;
|
29 |
import com.spice.profitmandi.dao.model.UserCart;
|
| Line 34... |
Line 31... |
| 34 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
31 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
| 35 |
import com.spice.profitmandi.dao.repository.fofo.CatalogFavouriteRepository;
|
32 |
import com.spice.profitmandi.dao.repository.fofo.CatalogFavouriteRepository;
|
| 36 |
import com.spice.profitmandi.dao.repository.fofo.SuggestedPoDetailRepository;
|
33 |
import com.spice.profitmandi.dao.repository.fofo.SuggestedPoDetailRepository;
|
| 37 |
import com.spice.profitmandi.dao.repository.fofo.SuggestedPoRepository;
|
34 |
import com.spice.profitmandi.dao.repository.fofo.SuggestedPoRepository;
|
| 38 |
import com.spice.profitmandi.dao.repository.inventory.SaholicCISTableRepository;
|
35 |
import com.spice.profitmandi.dao.repository.inventory.SaholicCISTableRepository;
|
| - |
|
36 |
import com.spice.profitmandi.dao.repository.onboarding.BrandCommitRepository;
|
| 39 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
37 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 40 |
import com.spice.profitmandi.service.catalog.BrandsService;
|
38 |
import com.spice.profitmandi.service.catalog.BrandsService;
|
| 41 |
import com.spice.profitmandi.service.inventory.*;
|
39 |
import com.spice.profitmandi.service.inventory.*;
|
| 42 |
import com.spice.profitmandi.service.pricecircular.PriceCircularItemModelNew;
|
40 |
import com.spice.profitmandi.service.pricecircular.PriceCircularItemModelNew;
|
| 43 |
import com.spice.profitmandi.service.pricecircular.PriceCircularModel;
|
41 |
import com.spice.profitmandi.service.pricecircular.PriceCircularModel;
|
| Line 61... |
Line 59... |
| 61 |
import org.springframework.http.HttpStatus;
|
59 |
import org.springframework.http.HttpStatus;
|
| 62 |
import org.springframework.http.MediaType;
|
60 |
import org.springframework.http.MediaType;
|
| 63 |
import org.springframework.http.ResponseEntity;
|
61 |
import org.springframework.http.ResponseEntity;
|
| 64 |
import org.springframework.stereotype.Controller;
|
62 |
import org.springframework.stereotype.Controller;
|
| 65 |
import org.springframework.transaction.annotation.Transactional;
|
63 |
import org.springframework.transaction.annotation.Transactional;
|
| 66 |
import org.springframework.web.bind.annotation.PathVariable;
|
- |
|
| 67 |
import org.springframework.web.bind.annotation.RequestMapping;
|
- |
|
| 68 |
import org.springframework.web.bind.annotation.RequestMethod;
|
- |
|
| 69 |
import org.springframework.web.bind.annotation.RequestParam;
|
64 |
import org.springframework.web.bind.annotation.*;
|
| 70 |
|
65 |
|
| 71 |
import javax.servlet.http.HttpServletRequest;
|
66 |
import javax.servlet.http.HttpServletRequest;
|
| 72 |
import java.time.LocalDate;
|
67 |
import java.time.LocalDate;
|
| 73 |
import java.time.LocalDateTime;
|
68 |
import java.time.LocalDateTime;
|
| 74 |
import java.util.*;
|
69 |
import java.util.*;
|
| Line 170... |
Line 165... |
| 170 |
private WebProductListingRepository webProductListingRepository;
|
165 |
private WebProductListingRepository webProductListingRepository;
|
| 171 |
|
166 |
|
| 172 |
@Autowired
|
167 |
@Autowired
|
| 173 |
private CatalogFavouriteRepository catalogFavouriteRepository;
|
168 |
private CatalogFavouriteRepository catalogFavouriteRepository;
|
| 174 |
|
169 |
|
| - |
|
170 |
@Autowired
|
| - |
|
171 |
PartnerOnBoardingPanelRepository partnerOnBoardingPanelRepository;
|
| - |
|
172 |
|
| - |
|
173 |
@Autowired
|
| - |
|
174 |
PartnerDealerRepository partnerDealerRepository;
|
| - |
|
175 |
|
| - |
|
176 |
@Autowired
|
| - |
|
177 |
BrandCommitRepository brandCommitRepository;
|
| - |
|
178 |
|
| - |
|
179 |
@Autowired
|
| - |
|
180 |
CatalogRepository catalogRepository;
|
| - |
|
181 |
|
| 175 |
List<String> filterableParams = Arrays.asList("brand");
|
182 |
List<String> filterableParams = Arrays.asList("brand");
|
| 176 |
|
183 |
|
| 177 |
@RequestMapping(value = "/fofo/buckets", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
184 |
@RequestMapping(value = "/fofo/buckets", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 178 |
public ResponseEntity<?> getBuckets(HttpServletRequest request) throws ProfitMandiBusinessException {
|
185 |
public ResponseEntity<?> getBuckets(HttpServletRequest request) throws ProfitMandiBusinessException {
|
| 179 |
logger.info("Request " + request.getParameterMap());
|
186 |
logger.info("Request " + request.getParameterMap());
|
| Line 260... |
Line 267... |
| 260 |
UserCart uc = userAccountRepository.getUserCart(userId);
|
267 |
UserCart uc = userAccountRepository.getUserCart(userId);
|
| 261 |
int fofoId = uc.getUserId();
|
268 |
int fofoId = uc.getUserId();
|
| 262 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
269 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
| 263 |
Set<Integer> catalogIds = catalogFavouriteRepository.selectBypartnerId(fofoId).stream().map(x -> x.getCatalogId()).collect(Collectors.toSet());
|
270 |
Set<Integer> catalogIds = catalogFavouriteRepository.selectBypartnerId(fofoId).stream().map(x -> x.getCatalogId()).collect(Collectors.toSet());
|
| 264 |
if (!catalogIds.isEmpty()) {
|
271 |
if (!catalogIds.isEmpty()) {
|
| 265 |
dealResponse = webSolrService.dealResponse(catalogIds,fofoId);
|
272 |
dealResponse = webSolrService.dealResponse(catalogIds, fofoId);
|
| 266 |
}
|
273 |
}
|
| 267 |
return responseSender.ok(dealResponse);
|
274 |
return responseSender.ok(dealResponse);
|
| 268 |
}
|
275 |
}
|
| 269 |
|
276 |
|
| 270 |
@RequestMapping(value = "/favourites/manage", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
277 |
@RequestMapping(value = "/favourites/manage", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
| Line 957... |
Line 964... |
| 957 |
fdi.setMop((float) childItem.getDouble("mop_f"));
|
964 |
fdi.setMop((float) childItem.getDouble("mop_f"));
|
| 958 |
fdi.setColor(childItem.has("color_s") ? childItem.getString("color_s") : "");
|
965 |
fdi.setColor(childItem.has("color_s") ? childItem.getString("color_s") : "");
|
| 959 |
if (fdi.getColor().equalsIgnoreCase("any colour")) {
|
966 |
if (fdi.getColor().equalsIgnoreCase("any colour")) {
|
| 960 |
fdiAnyColour = fdi;
|
967 |
fdiAnyColour = fdi;
|
| 961 |
}
|
968 |
}
|
| - |
|
969 |
fdi.setBrand((String) doc.getJSONArray("brand_ss").get(0));
|
| - |
|
970 |
fdi.setCategoryId(doc.getInt("subCategoryId_i"));
|
| 962 |
fdi.setTagId(childItem.getInt("tagId_i"));
|
971 |
fdi.setTagId(childItem.getInt("tagId_i"));
|
| 963 |
fdi.setItem_id(itemId);
|
972 |
fdi.setItem_id(itemId);
|
| 964 |
Float cashBack = schemeService.getCatalogSchemeCashBack(fofoId, Arrays.asList(fofoCatalogResponse.getCatalogId())).get(fofoCatalogResponse.getCatalogId());
|
973 |
Float cashBack = schemeService.getCatalogSchemeCashBack(fofoId, Arrays.asList(fofoCatalogResponse.getCatalogId())).get(fofoCatalogResponse.getCatalogId());
|
| 965 |
cashBack = cashBack == null ? 0 : cashBack;
|
974 |
cashBack = cashBack == null ? 0 : cashBack;
|
| 966 |
fdi.setCashback(cashBack);
|
975 |
fdi.setCashback(cashBack);
|
| Line 1115... |
Line 1124... |
| 1115 |
|
1124 |
|
| 1116 |
return responseSender.ok(isCombo);
|
1125 |
return responseSender.ok(isCombo);
|
| 1117 |
}
|
1126 |
}
|
| 1118 |
|
1127 |
|
| 1119 |
|
1128 |
|
| - |
|
1129 |
@GetMapping(value = "/partner/wodCompleteBrands", produces = MediaType.APPLICATION_JSON_VALUE)
|
| - |
|
1130 |
public ResponseEntity<?> getWodcompletBrands(HttpServletRequest request) throws Exception {
|
| - |
|
1131 |
|
| - |
|
1132 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| - |
|
1133 |
FofoStore fofoStore = fofoStoreRepository.selectByRetailerId(userInfo.getRetailerId());
|
| - |
|
1134 |
|
| - |
|
1135 |
PartnerOnBoardingPanel partnerOnBoardingPanel = partnerOnBoardingPanelRepository.selectByCode(fofoStore.getCode());
|
| - |
|
1136 |
List<PartnerDealerMapping> partnerDealerMappingList = partnerDealerRepository.selectByOnboardingId(partnerOnBoardingPanel.getId());
|
| - |
|
1137 |
|
| - |
|
1138 |
// TODO uncomment this line after some time when RetailerId Insert in all dealerMapping
|
| - |
|
1139 |
// List<PartnerDealerMapping> partnerDealerMappingList = partnerDealerRepository.selectByRetailerId(userInfo.getRetailerId());
|
| - |
|
1140 |
|
| - |
|
1141 |
BrandAndAddToCartEligibleModel partnerWorkingBrandMappingModel = new BrandAndAddToCartEligibleModel();
|
| - |
|
1142 |
|
| - |
|
1143 |
//working brands -> Partner only work with brands that having 'Dealer Code'
|
| - |
|
1144 |
List<String> wodCompletedBrands = partnerDealerMappingList.stream().filter(x -> x.getBrandCode().trim().length() > 0).map(x -> x.getBrand()).collect(Collectors.toList());
|
| - |
|
1145 |
partnerWorkingBrandMappingModel.setWodCompleteBrands(wodCompletedBrands);
|
| - |
|
1146 |
|
| - |
|
1147 |
//brandsToBeCheck
|
| - |
|
1148 |
List<String> wodRequiredBrand = brandCommitRepository.selectAllActiveBrand().stream().filter(x -> x.isNocRequired()).map(x -> x.getBrand()).collect(Collectors.toList());
|
| - |
|
1149 |
partnerWorkingBrandMappingModel.setWodRequiredBrands(wodRequiredBrand);
|
| - |
|
1150 |
return responseSender.ok(partnerWorkingBrandMappingModel);
|
| - |
|
1151 |
|
| - |
|
1152 |
}
|
| - |
|
1153 |
|
| 1120 |
}
|
1154 |
}
|
| 1121 |
|
1155 |
|