| 21429 |
kshitij.so |
1 |
package com.spice.profitmandi.web.controller;
|
|
|
2 |
|
|
|
3 |
import java.time.LocalDateTime;
|
|
|
4 |
|
|
|
5 |
import javax.servlet.http.HttpServletRequest;
|
|
|
6 |
|
|
|
7 |
import org.json.JSONObject;
|
| 23568 |
govind |
8 |
import org.apache.logging.log4j.Logger;
|
|
|
9 |
import org.apache.logging.log4j.LogManager;
|
| 22173 |
amit.gupta |
10 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 21429 |
kshitij.so |
11 |
import org.springframework.http.HttpStatus;
|
|
|
12 |
import org.springframework.http.MediaType;
|
|
|
13 |
import org.springframework.http.ResponseEntity;
|
|
|
14 |
import org.springframework.stereotype.Controller;
|
|
|
15 |
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
16 |
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
17 |
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
18 |
|
|
|
19 |
import com.google.gson.Gson;
|
|
|
20 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 21740 |
ashik.ali |
21 |
import com.spice.profitmandi.common.model.ProfitMandiResponse;
|
|
|
22 |
import com.spice.profitmandi.common.model.ResponseStatus;
|
| 22931 |
ashik.ali |
23 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 21429 |
kshitij.so |
24 |
import com.spice.profitmandi.dao.model.LimitedMasterDataPojo;
|
| 21735 |
ashik.ali |
25 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
| 21429 |
kshitij.so |
26 |
|
|
|
27 |
import io.swagger.annotations.ApiImplicitParam;
|
|
|
28 |
import io.swagger.annotations.ApiImplicitParams;
|
|
|
29 |
import io.swagger.annotations.ApiOperation;
|
|
|
30 |
|
|
|
31 |
@Controller
|
|
|
32 |
public class MasterDataController {
|
|
|
33 |
|
| 23568 |
govind |
34 |
private static final Logger logger=LogManager.getLogger(MasterDataController.class);
|
| 21429 |
kshitij.so |
35 |
|
| 22931 |
ashik.ali |
36 |
@Autowired
|
|
|
37 |
private Mongo mongoClient;
|
| 22173 |
amit.gupta |
38 |
|
|
|
39 |
@Autowired
|
| 22931 |
ashik.ali |
40 |
private ResponseSender<?> responseSender;
|
| 22173 |
amit.gupta |
41 |
|
|
|
42 |
|
| 21429 |
kshitij.so |
43 |
@RequestMapping(value = ProfitMandiConstants.URL_MASTER_DATA, method=RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
44 |
@ApiImplicitParams({
|
|
|
45 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token",
|
|
|
46 |
required = true, dataType = "string", paramType = "header")
|
|
|
47 |
})
|
|
|
48 |
@ApiOperation(value = "Get limited info of master data for skuBundleId")
|
| 22931 |
ashik.ali |
49 |
public ResponseEntity<?> getMasterDataBySkuBundleId(HttpServletRequest request, @PathVariable(value="id") long skuBundleId) throws Exception{
|
|
|
50 |
|
|
|
51 |
JSONObject jsonObject = mongoClient.getItemsByBundleId(skuBundleId);
|
|
|
52 |
LimitedMasterDataPojo masterData = new Gson().fromJson(jsonObject.toString(), LimitedMasterDataPojo.class);
|
|
|
53 |
return responseSender.ok(masterData);
|
| 21429 |
kshitij.so |
54 |
}
|
|
|
55 |
|
|
|
56 |
}
|