Subversion Repositories SmartDukaan

Rev

Rev 21740 | Rev 22931 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 21740 Rev 22173
Line 5... Line 5...
5
import javax.servlet.http.HttpServletRequest;
5
import javax.servlet.http.HttpServletRequest;
6
 
6
 
7
import org.json.JSONObject;
7
import org.json.JSONObject;
8
import org.slf4j.Logger;
8
import org.slf4j.Logger;
9
import org.slf4j.LoggerFactory;
9
import org.slf4j.LoggerFactory;
-
 
10
import org.springframework.beans.factory.annotation.Autowired;
10
import org.springframework.http.HttpStatus;
11
import org.springframework.http.HttpStatus;
11
import org.springframework.http.MediaType;
12
import org.springframework.http.MediaType;
12
import org.springframework.http.ResponseEntity;
13
import org.springframework.http.ResponseEntity;
13
import org.springframework.stereotype.Controller;
14
import org.springframework.stereotype.Controller;
14
import org.springframework.web.bind.annotation.PathVariable;
15
import org.springframework.web.bind.annotation.PathVariable;
Line 29... Line 30...
29
@Controller
30
@Controller
30
public class MasterDataController {
31
public class MasterDataController {
31
	
32
	
32
	private static final Logger logger=LoggerFactory.getLogger(MasterDataController.class);
33
	private static final Logger logger=LoggerFactory.getLogger(MasterDataController.class);
33
 
34
 
-
 
35
	
-
 
36
 
-
 
37
	@Autowired
-
 
38
	Mongo mongoClient;
-
 
39
	
34
 
40
 
35
	@RequestMapping(value = ProfitMandiConstants.URL_MASTER_DATA, method=RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
41
	@RequestMapping(value = ProfitMandiConstants.URL_MASTER_DATA, method=RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
36
	@ApiImplicitParams({
42
	@ApiImplicitParams({
37
		@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", 
43
		@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", 
38
				required = true, dataType = "string", paramType = "header")
44
				required = true, dataType = "string", paramType = "header")
39
	})
45
	})
40
	@ApiOperation(value = "Get limited info of master data for skuBundleId")
46
	@ApiOperation(value = "Get limited info of master data for skuBundleId")
41
	public ResponseEntity<?> getMasterDataBySkuBundleId(HttpServletRequest request, @PathVariable(value="id") long skuBundleId){
47
	public ResponseEntity<?> getMasterDataBySkuBundleId(HttpServletRequest request, @PathVariable(value="id") long skuBundleId){
42
		LimitedMasterDataPojo masterData = null;
48
		LimitedMasterDataPojo masterData = null;
43
		try {
49
		try {
44
			JSONObject jsonObject = Mongo.getItemsByBundleId(skuBundleId);
50
			JSONObject jsonObject = mongoClient.getItemsByBundleId(skuBundleId);
45
			masterData = new Gson().fromJson(jsonObject.toString(), LimitedMasterDataPojo.class);
51
			masterData = new Gson().fromJson(jsonObject.toString(), LimitedMasterDataPojo.class);
46
			final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString() , HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, masterData);
52
			final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString() , HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, masterData);
47
			return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
53
			return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
48
		} catch (Exception e) {
54
		} catch (Exception e) {
49
			logger.info("Unable to get skuBundleId "+skuBundleId,e);
55
			logger.info("Unable to get skuBundleId "+skuBundleId,e);