| Line 38... |
Line 38... |
| 38 |
import com.spice.profitmandi.common.model.ResponseStatus;
|
38 |
import com.spice.profitmandi.common.model.ResponseStatus;
|
| 39 |
import com.spice.profitmandi.common.model.UserInfo;
|
39 |
import com.spice.profitmandi.common.model.UserInfo;
|
| 40 |
import com.spice.profitmandi.common.web.client.RestClient;
|
40 |
import com.spice.profitmandi.common.web.client.RestClient;
|
| 41 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
41 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 42 |
import com.spice.profitmandi.dao.enumuration.dtr.RoleType;
|
42 |
import com.spice.profitmandi.dao.enumuration.dtr.RoleType;
|
| - |
|
43 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
| 43 |
import com.spice.profitmandi.service.pricing.PricingService;
|
44 |
import com.spice.profitmandi.service.pricing.PricingService;
|
| 44 |
import com.spice.profitmandi.web.res.DealBrands;
|
45 |
import com.spice.profitmandi.web.res.DealBrands;
|
| 45 |
import com.spice.profitmandi.web.res.DealObjectResponse;
|
46 |
import com.spice.profitmandi.web.res.DealObjectResponse;
|
| 46 |
import com.spice.profitmandi.web.res.DealsResponse;
|
47 |
import com.spice.profitmandi.web.res.DealsResponse;
|
| 47 |
import com.spice.profitmandi.web.res.FofoAvailabilityInfo;
|
48 |
import com.spice.profitmandi.web.res.FofoAvailabilityInfo;
|
| Line 64... |
Line 65... |
| 64 |
|
65 |
|
| 65 |
@Autowired
|
66 |
@Autowired
|
| 66 |
private PricingService pricingService;
|
67 |
private PricingService pricingService;
|
| 67 |
|
68 |
|
| 68 |
@Autowired
|
69 |
@Autowired
|
| - |
|
70 |
private Mongo mongoClient;
|
| - |
|
71 |
|
| - |
|
72 |
@Autowired
|
| 69 |
ResponseSender<?> responseSender;
|
73 |
ResponseSender<?> responseSender;
|
| 70 |
|
74 |
|
| 71 |
@RequestMapping(value = ProfitMandiConstants.URL_DEALS, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
75 |
@RequestMapping(value = ProfitMandiConstants.URL_DEALS, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 72 |
@ApiImplicitParams({
|
76 |
@ApiImplicitParams({
|
| 73 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
77 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| Line 158... |
Line 162... |
| 158 |
JSONObject doc = docs.getJSONObject(i);
|
162 |
JSONObject doc = docs.getJSONObject(i);
|
| 159 |
FofoCatalogResponse ffdr = new FofoCatalogResponse();
|
163 |
FofoCatalogResponse ffdr = new FofoCatalogResponse();
|
| 160 |
ffdr.setCatalogId(doc.getInt("catalogId_i"));
|
164 |
ffdr.setCatalogId(doc.getInt("catalogId_i"));
|
| 161 |
ffdr.setImageUrl(doc.getString("imageUrl_s"));
|
165 |
ffdr.setImageUrl(doc.getString("imageUrl_s"));
|
| 162 |
ffdr.setTitle(doc.getString("title_s"));
|
166 |
ffdr.setTitle(doc.getString("title_s"));
|
| - |
|
167 |
ffdr.setBrand(doc.getString("brand_s"));
|
| 163 |
for(int j=0; j< doc.getJSONArray("_childDocuments_").length(); j++) {
|
168 |
for(int j=0; j< doc.getJSONArray("_childDocuments_").length(); j++) {
|
| 164 |
JSONObject childItem = doc.getJSONArray("_childDocuments_").getJSONObject(j);
|
169 |
JSONObject childItem = doc.getJSONArray("_childDocuments_").getJSONObject(j);
|
| 165 |
int itemId = childItem.getInt("itemId_i");
|
170 |
int itemId = childItem.getInt("itemId_i");
|
| 166 |
float sellingPrice = (float)childItem.getDouble("sellingPrice_f");
|
171 |
float sellingPrice = (float)childItem.getDouble("sellingPrice_f");
|
| 167 |
if(fofoAvailabilityInfoMap.containsKey(itemId)) {
|
172 |
if(fofoAvailabilityInfoMap.containsKey(itemId)) {
|
| Line 334... |
Line 339... |
| 334 |
final ProfitMandiResponse<?> profitMandiResponse = new ProfitMandiResponse<>(LocalDateTime.now(),
|
339 |
final ProfitMandiResponse<?> profitMandiResponse = new ProfitMandiResponse<>(LocalDateTime.now(),
|
| 335 |
request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS,
|
340 |
request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS,
|
| 336 |
dealsResponse);
|
341 |
dealsResponse);
|
| 337 |
return new ResponseEntity<>(profitMandiResponse, HttpStatus.OK);
|
342 |
return new ResponseEntity<>(profitMandiResponse, HttpStatus.OK);
|
| 338 |
}
|
343 |
}
|
| - |
|
344 |
|
| - |
|
345 |
@RequestMapping(value = "/fofo/brands", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| - |
|
346 |
public ResponseEntity<?> getBrandsToDisplay() {
|
| - |
|
347 |
return new ResponseEntity<>(mongoClient.getBrandsToDisplay(), HttpStatus.OK);
|
| - |
|
348 |
}
|
| 339 |
|
349 |
|
| 340 |
}
|
350 |
}
|