Subversion Repositories SmartDukaan

Rev

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

Rev 21302 Rev 21309
Line 43... Line 43...
43
		@SuppressWarnings("unchecked")
43
		@SuppressWarnings("unchecked")
44
		final Map<String, Object>  createShopMap = (Map<String, Object>)request.getAttribute(ProfitMandiConstants.CREATE_SHOP_MAP);
44
		final Map<String, Object>  createShopMap = (Map<String, Object>)request.getAttribute(ProfitMandiConstants.CREATE_SHOP_MAP);
45
		request.removeAttribute(ProfitMandiConstants.CREATE_SHOP_MAP);
45
		request.removeAttribute(ProfitMandiConstants.CREATE_SHOP_MAP);
46
		
46
		
47
		try {
47
		try {
48
			final Retailer retailer = retailerRepository.selectById(createShopMap.get(ProfitMandiConstants.RETAILER_ID).toString());
48
			final Retailer retailer = retailerRepository.selectById((long)createShopMap.get(ProfitMandiConstants.RETAILER_ID));
49
			Shop shop = new Shop();
49
			Shop shop = new Shop();
50
			shop.setRetailer(retailer);
50
			shop.setRetailer(retailer);
51
			shop.setName(createShopMap.get(ProfitMandiConstants.NAME).toString());
51
			shop.setName(createShopMap.get(ProfitMandiConstants.NAME).toString());
52
			shop.setCreateTimestamp(LocalDateTime.now());
52
			shop.setCreateTimestamp(LocalDateTime.now());
53
			shop.setUpdateTimestamp(LocalDateTime.now());
53
			shop.setUpdateTimestamp(LocalDateTime.now());
Line 79... Line 79...
79
			final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
79
			final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.INTERNAL_SERVER_ERROR.toString(), HttpStatus.INTERNAL_SERVER_ERROR, ResponseStatus.FAILURE, response);
80
			return new ResponseEntity<>(chatOnResponse,HttpStatus.INTERNAL_SERVER_ERROR);
80
			return new ResponseEntity<>(chatOnResponse,HttpStatus.INTERNAL_SERVER_ERROR);
81
		}
81
		}
82
	}
82
	}
83
	@RequestMapping(value = ProfitMandiConstants.URL_SHOP_ID, method=RequestMethod.GET)
83
	@RequestMapping(value = ProfitMandiConstants.URL_SHOP_ID, method=RequestMethod.GET)
84
	public ResponseEntity<?> getById(HttpServletRequest request, @RequestParam(name = "id") String id){
84
	public ResponseEntity<?> getById(HttpServletRequest request, @RequestParam(name = "id") long id){
85
		LOGGER.info("requested url : "+request.getRequestURL().toString());
85
		LOGGER.info("requested url : "+request.getRequestURL().toString());
86
		try {
86
		try {
87
			final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, shopRepository.selectById(id));
87
			final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, shopRepository.selectById(id));
88
			return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
88
			return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
89
		}catch (ProfitMandiBusinessException pmbe) {
89
		}catch (ProfitMandiBusinessException pmbe) {
Line 119... Line 119...
119
	}
119
	}
120
	
120
	
121
	
121
	
122
	
122
	
123
	@RequestMapping(value = ProfitMandiConstants.URL_SHOP_ID, method=RequestMethod.DELETE)
123
	@RequestMapping(value = ProfitMandiConstants.URL_SHOP_ID, method=RequestMethod.DELETE)
124
	public ResponseEntity<?> removeById(HttpServletRequest request, @RequestParam(name = "id") String id){
124
	public ResponseEntity<?> removeById(HttpServletRequest request, @RequestParam(name = "id") long id){
125
		LOGGER.info("requested url : "+request.getRequestURL().toString());
125
		LOGGER.info("requested url : "+request.getRequestURL().toString());
126
		try {
126
		try {
127
			shopRepository.deleteById(id);
127
			shopRepository.deleteById(id);
128
			final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, ResponseCodeHolder.getMessage("API_OK_1001"));
128
			final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, ResponseCodeHolder.getMessage("API_OK_1001"));
129
			return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
129
			return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);