Rev 22931 | Blame | Compare with Previous | Last modification | View Log | RSS feed
package com.spice.profitmandi.web.controller;import java.time.LocalDateTime;import javax.servlet.http.HttpServletRequest;import org.json.JSONObject;import org.apache.logging.log4j.Logger;import org.apache.logging.log4j.LogManager;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.http.HttpStatus;import org.springframework.http.MediaType;import org.springframework.http.ResponseEntity;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.PathVariable;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestMethod;import com.google.gson.Gson;import com.spice.profitmandi.common.model.ProfitMandiConstants;import com.spice.profitmandi.common.model.ProfitMandiResponse;import com.spice.profitmandi.common.model.ResponseStatus;import com.spice.profitmandi.common.web.util.ResponseSender;import com.spice.profitmandi.dao.model.LimitedMasterDataPojo;import com.spice.profitmandi.dao.repository.dtr.Mongo;import io.swagger.annotations.ApiImplicitParam;import io.swagger.annotations.ApiImplicitParams;import io.swagger.annotations.ApiOperation;@Controllerpublic class MasterDataController {private static final Logger logger=LogManager.getLogger(MasterDataController.class);@Autowiredprivate Mongo mongoClient;@Autowiredprivate ResponseSender<?> responseSender;@RequestMapping(value = ProfitMandiConstants.URL_MASTER_DATA, method=RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)@ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token",required = true, dataType = "string", paramType = "header")})@ApiOperation(value = "Get limited info of master data for skuBundleId")public ResponseEntity<?> getMasterDataBySkuBundleId(HttpServletRequest request, @PathVariable(value="id") long skuBundleId) throws Exception{JSONObject jsonObject = mongoClient.getItemsByBundleId(skuBundleId);LimitedMasterDataPojo masterData = new Gson().fromJson(jsonObject.toString(), LimitedMasterDataPojo.class);return responseSender.ok(masterData);}}