| Line 25... |
Line 25... |
| 25 |
import com.spice.profitmandi.dao.entity.inventory.SaholicCISTable;
|
25 |
import com.spice.profitmandi.dao.entity.inventory.SaholicCISTable;
|
| 26 |
import com.spice.profitmandi.dao.entity.inventory.SaholicPOItem;
|
26 |
import com.spice.profitmandi.dao.entity.inventory.SaholicPOItem;
|
| 27 |
import com.spice.profitmandi.dao.entity.similarModel.SimilarModel;
|
27 |
import com.spice.profitmandi.dao.entity.similarModel.SimilarModel;
|
| 28 |
import com.spice.profitmandi.dao.enumuration.dtr.WebListingSource;
|
28 |
import com.spice.profitmandi.dao.enumuration.dtr.WebListingSource;
|
| 29 |
import com.spice.profitmandi.dao.enumuration.dtr.WebListingType;
|
29 |
import com.spice.profitmandi.dao.enumuration.dtr.WebListingType;
|
| - |
|
30 |
import com.spice.profitmandi.dao.enumuration.transaction.SuggestedPoStatus;
|
| 30 |
import com.spice.profitmandi.dao.model.AmountModel;
|
31 |
import com.spice.profitmandi.dao.model.AmountModel;
|
| 31 |
import com.spice.profitmandi.dao.model.CreateOfferRequest;
|
32 |
import com.spice.profitmandi.dao.model.CreateOfferRequest;
|
| 32 |
import com.spice.profitmandi.dao.model.UserCart;
|
33 |
import com.spice.profitmandi.dao.model.UserCart;
|
| 33 |
import com.spice.profitmandi.dao.repository.catalog.*;
|
34 |
import com.spice.profitmandi.dao.repository.catalog.*;
|
| 34 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
35 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
| Line 96... |
Line 97... |
| 96 |
|
97 |
|
| 97 |
@Autowired
|
98 |
@Autowired
|
| 98 |
SolrService solrService;
|
99 |
SolrService solrService;
|
| 99 |
|
100 |
|
| 100 |
@Autowired
|
101 |
@Autowired
|
| - |
|
102 |
com.spice.profitmandi.web.services.SolrService webSolrService;
|
| - |
|
103 |
|
| - |
|
104 |
@Autowired
|
| 101 |
InventoryService inventoryService;
|
105 |
InventoryService inventoryService;
|
| 102 |
|
106 |
|
| 103 |
// This is now unused as we are not supporting multiple companies.
|
107 |
// This is now unused as we are not supporting multiple companies.
|
| 104 |
@Value("${gadgetCops.invoice.cc}")
|
108 |
@Value("${gadgetCops.invoice.cc}")
|
| 105 |
private String[] ccGadgetCopInvoiceTo;
|
109 |
private String[] ccGadgetCopInvoiceTo;
|
| Line 243... |
Line 247... |
| 243 |
@ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
247 |
@ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
| 244 |
@ApiOperation(value = "")
|
248 |
@ApiOperation(value = "")
|
| 245 |
public ResponseEntity<?> changeSuggestedPoStatus(HttpServletRequest request, @RequestParam int id) throws ProfitMandiBusinessException {
|
249 |
public ResponseEntity<?> changeSuggestedPoStatus(HttpServletRequest request, @RequestParam int id) throws ProfitMandiBusinessException {
|
| 246 |
SuggestedPo suggestedPo = suggestedPoRepository.selectById(id);
|
250 |
SuggestedPo suggestedPo = suggestedPoRepository.selectById(id);
|
| 247 |
suggestedPo.setStatus("closed");
|
251 |
suggestedPo.setStatus("closed");
|
| - |
|
252 |
//suggestedPo.setStatus(SuggestedPoStatus.valueOf("closed"));
|
| 248 |
|
253 |
|
| 249 |
return responseSender.ok(true);
|
254 |
return responseSender.ok(true);
|
| 250 |
}
|
255 |
}
|
| 251 |
|
256 |
|
| 252 |
@RequestMapping(value = "/fofo/fovourites", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
257 |
@RequestMapping(value = "/fofo/fovourites", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| Line 256... |
Line 261... |
| 256 |
UserCart uc = userAccountRepository.getUserCart(userId);
|
261 |
UserCart uc = userAccountRepository.getUserCart(userId);
|
| 257 |
int fofoId = uc.getUserId();
|
262 |
int fofoId = uc.getUserId();
|
| 258 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
263 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
| 259 |
Set<Integer> catalogIds = catalogFavouriteRepository.selectBypartnerId(fofoId).stream().map(x -> x.getCatalogId()).collect(Collectors.toSet());
|
264 |
Set<Integer> catalogIds = catalogFavouriteRepository.selectBypartnerId(fofoId).stream().map(x -> x.getCatalogId()).collect(Collectors.toSet());
|
| 260 |
if (!catalogIds.isEmpty()) {
|
265 |
if (!catalogIds.isEmpty()) {
|
| 261 |
|
- |
|
| 262 |
RestClient rc = new RestClient();
|
- |
|
| 263 |
Map<String, String> params = new HashMap<>();
|
- |
|
| 264 |
List<String> mandatoryQ = new ArrayList<>();
|
- |
|
| 265 |
mandatoryQ.add(String.format("+catalogId_i:(%s) +{!parent which=\"id:catalog*\"}", StringUtils.join(catalogIds, " ")));
|
- |
|
| 266 |
params.put("start", "0");
|
- |
|
| 267 |
params.put("rows", "100");
|
- |
|
| 268 |
params.put("q", StringUtils.join(mandatoryQ, " "));
|
- |
|
| 269 |
params.put("fl", "*, [child parentFilter=id:catalog*]");
|
- |
|
| 270 |
|
- |
|
| 271 |
params.put("wt", "json");
|
- |
|
| 272 |
String response = null;
|
- |
|
| 273 |
try {
|
- |
|
| 274 |
response = rc.get(SchemeType.HTTP, solrUrl, 8984, "solr/demo/select", params);
|
- |
|
| 275 |
} catch (HttpHostConnectException e) {
|
- |
|
| 276 |
throw new ProfitMandiBusinessException("", "", "Could not connect to host");
|
- |
|
| 277 |
}
|
- |
|
| 278 |
JSONObject solrResponseJSONObj = new JSONObject(response).getJSONObject("response");
|
- |
|
| 279 |
JSONArray docs = solrResponseJSONObj.getJSONArray("docs");
|
- |
|
| 280 |
dealResponse = getCatalogResponse(docs, false, fofoId);
|
266 |
dealResponse = webSolrService.dealResponse(catalogIds,fofoId);
|
| 281 |
}
|
267 |
}
|
| 282 |
return responseSender.ok(dealResponse);
|
268 |
return responseSender.ok(dealResponse);
|
| 283 |
}
|
269 |
}
|
| 284 |
|
270 |
|
| 285 |
@RequestMapping(value = "/favourites/manage", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
271 |
@RequestMapping(value = "/favourites/manage", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
| Line 1041... |
Line 1027... |
| 1041 |
|
1027 |
|
| 1042 |
}
|
1028 |
}
|
| 1043 |
|
1029 |
|
| 1044 |
private List<FofoCatalogResponse> getCatalogSingleSkuResponse(JSONArray
|
1030 |
private List<FofoCatalogResponse> getCatalogSingleSkuResponse(JSONArray
|
| 1045 |
docs, Map<Integer, Integer> itemFilter, boolean hotDeal) throws ProfitMandiBusinessException {
|
1031 |
docs, Map<Integer, Integer> itemFilter, boolean hotDeal) throws ProfitMandiBusinessException {
|
| 1046 |
Map<Integer, TagListing> itemTagListingMap = null;
|
- |
|
| 1047 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
1032 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
| 1048 |
List<Integer> tagIds = Arrays.asList(4);
|
1033 |
List<Integer> tagIds = Arrays.asList(4);
|
| 1049 |
|
1034 |
|
| 1050 |
itemTagListingMap = tagListingRepository.selectByItemIdsAndTagIds(itemFilter.keySet(), new HashSet<>(tagIds)).stream().collect(Collectors.toMap(x -> x.getItemId(), x -> x));
|
1035 |
Map<Integer, TagListing> itemTagListingMap = tagListingRepository.selectByItemIdsAndTagIds(itemFilter.keySet(), new HashSet<>(tagIds)).stream().collect(Collectors.toMap(x -> x.getItemId(), x -> x));
|
| 1051 |
|
1036 |
|
| 1052 |
for (int i = 0; i < docs.length(); i++) {
|
1037 |
for (int i = 0; i < docs.length(); i++) {
|
| 1053 |
Map<Integer, FofoAvailabilityInfo> fofoAvailabilityInfoMap = new HashMap<>();
|
1038 |
Map<Integer, FofoAvailabilityInfo> fofoAvailabilityInfoMap = new HashMap<>();
|
| 1054 |
JSONObject doc = docs.getJSONObject(i);
|
1039 |
JSONObject doc = docs.getJSONObject(i);
|
| 1055 |
|
1040 |
|