| Line 33... |
Line 33... |
| 33 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
33 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 34 |
import com.spice.profitmandi.common.model.ProfitMandiResponse;
|
34 |
import com.spice.profitmandi.common.model.ProfitMandiResponse;
|
| 35 |
import com.spice.profitmandi.common.model.ResponseStatus;
|
35 |
import com.spice.profitmandi.common.model.ResponseStatus;
|
| 36 |
import com.spice.profitmandi.common.web.client.RestClient;
|
36 |
import com.spice.profitmandi.common.web.client.RestClient;
|
| 37 |
import com.spice.profitmandi.dao.entity.catalog.Tag;
|
37 |
import com.spice.profitmandi.dao.entity.catalog.Tag;
|
| - |
|
38 |
import com.spice.profitmandi.service.pricing.PricingService;
|
| 38 |
import com.spice.profitmandi.service.tag.TagService;
|
39 |
import com.spice.profitmandi.service.tag.TagService;
|
| 39 |
import com.spice.profitmandi.web.res.DealBrands;
|
40 |
import com.spice.profitmandi.web.res.DealBrands;
|
| 40 |
import com.spice.profitmandi.web.res.DealObjectResponse;
|
41 |
import com.spice.profitmandi.web.res.DealObjectResponse;
|
| 41 |
import com.spice.profitmandi.web.res.DealsResponse;
|
42 |
import com.spice.profitmandi.web.res.DealsResponse;
|
| 42 |
|
43 |
|
| Line 54... |
Line 55... |
| 54 |
private String host;
|
55 |
private String host;
|
| 55 |
@Value("${python.api.port}")
|
56 |
@Value("${python.api.port}")
|
| 56 |
private int port;
|
57 |
private int port;
|
| 57 |
|
58 |
|
| 58 |
@Autowired
|
59 |
@Autowired
|
| 59 |
private TagService tagService;
|
60 |
private PricingService pricingService;
|
| 60 |
|
61 |
|
| 61 |
@RequestMapping(value = ProfitMandiConstants.URL_DEALS, method=RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
62 |
@RequestMapping(value = ProfitMandiConstants.URL_DEALS, method=RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
| 62 |
@ApiImplicitParams({
|
63 |
@ApiImplicitParams({
|
| 63 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token",
|
64 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token",
|
| 64 |
required = true, dataType = "string", paramType = "header")
|
65 |
required = true, dataType = "string", paramType = "header")
|
| Line 105... |
Line 106... |
| 105 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
106 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
| 106 |
}
|
107 |
}
|
| 107 |
|
108 |
|
| 108 |
|
109 |
|
| 109 |
private String getCommaSeparateTags(int userId) {
|
110 |
private String getCommaSeparateTags(int userId) {
|
| 110 |
List<Tag> tags = tagService.getTagsByRetailerId(userId);
|
111 |
List<Integer> tagIds = pricingService.getTagsIdsByRetailerId(userId);
|
| 111 |
List<String> tagIds = new ArrayList<>();
|
112 |
List<String> strTagIds = new ArrayList<>();
|
| 112 |
for (Tag tag : tags) {
|
113 |
for (Integer tagId : tagIds) {
|
| 113 |
tagIds.add(String.valueOf(tag.getId()));
|
114 |
strTagIds.add(String.valueOf(tagId));
|
| 114 |
}
|
115 |
}
|
| 115 |
return String.join(",", tagIds);
|
116 |
return String.join(",", strTagIds);
|
| 116 |
}
|
117 |
}
|
| 117 |
|
118 |
|
| 118 |
|
119 |
|
| 119 |
@RequestMapping(value = "/online-deals", method=RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
120 |
@RequestMapping(value = "/online-deals", method=RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
| 120 |
@ApiImplicitParams({
|
121 |
@ApiImplicitParams({
|