| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.web.controller;
|
1 |
package com.spice.profitmandi.web.controller;
|
| 2 |
|
2 |
|
| 3 |
import java.time.LocalDateTime;
|
- |
|
| 4 |
|
- |
|
| 5 |
import javax.servlet.http.HttpServletRequest;
|
3 |
import javax.servlet.http.HttpServletRequest;
|
| 6 |
|
4 |
|
| 7 |
import org.slf4j.Logger;
|
5 |
import org.slf4j.Logger;
|
| 8 |
import org.slf4j.LoggerFactory;
|
6 |
import org.slf4j.LoggerFactory;
|
| 9 |
import org.springframework.beans.factory.annotation.Autowired;
|
7 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 10 |
import org.springframework.http.HttpStatus;
|
- |
|
| 11 |
import org.springframework.http.ResponseEntity;
|
8 |
import org.springframework.http.ResponseEntity;
|
| 12 |
import org.springframework.stereotype.Controller;
|
9 |
import org.springframework.stereotype.Controller;
|
| 13 |
import org.springframework.web.bind.annotation.RequestMapping;
|
10 |
import org.springframework.web.bind.annotation.RequestMapping;
|
| 14 |
import org.springframework.web.bind.annotation.RequestMethod;
|
11 |
import org.springframework.web.bind.annotation.RequestMethod;
|
| 15 |
import org.springframework.web.bind.annotation.RequestParam;
|
12 |
import org.springframework.web.bind.annotation.RequestParam;
|
| 16 |
|
13 |
|
| 17 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
14 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 18 |
import com.spice.profitmandi.dao.repository.PostOfficeRepository;
|
15 |
import com.spice.profitmandi.dao.repository.PostOfficeRepository;
|
| 19 |
import com.spice.profitmandi.web.model.ProfitMandiResponse;
|
- |
|
| 20 |
import com.spice.profitmandi.web.model.ResponseStatus;
|
16 |
import com.spice.profitmandi.web.util.ResponseSender;
|
| 21 |
|
17 |
|
| 22 |
@Controller
|
18 |
@Controller
|
| 23 |
public class PostOfficeController {
|
19 |
public class PostOfficeController {
|
| 24 |
|
20 |
|
| - |
|
21 |
@Autowired
|
| - |
|
22 |
ResponseSender<?> responseSender;
|
| - |
|
23 |
|
| 25 |
private static final Logger LOGGER=LoggerFactory.getLogger(PostOfficeController.class);
|
24 |
private static final Logger LOGGER=LoggerFactory.getLogger(PostOfficeController.class);
|
| 26 |
|
25 |
|
| 27 |
@Autowired
|
26 |
@Autowired
|
| 28 |
PostOfficeRepository postOfficeRepository;
|
27 |
PostOfficeRepository postOfficeRepository;
|
| 29 |
|
28 |
|
| 30 |
@RequestMapping(value = ProfitMandiConstants.URL_POST_OFFICE, method=RequestMethod.GET)
|
29 |
@RequestMapping(value = ProfitMandiConstants.URL_POST_OFFICE, method=RequestMethod.GET)
|
| 31 |
public ResponseEntity<?> getByPin(HttpServletRequest request, @RequestParam(name = "pinCode") long pinCode){
|
30 |
public ResponseEntity<?> getByPin(HttpServletRequest request, @RequestParam(name = "pinCode") long pinCode){
|
| 32 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
31 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 33 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, postOfficeRepository.selectByPinCode(pinCode));
|
- |
|
| 34 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
32 |
return responseSender.ok(postOfficeRepository.selectByPinCode(pinCode));
|
| 35 |
|
33 |
|
| 36 |
}
|
34 |
}
|
| 37 |
}
|
35 |
}
|
| 38 |
|
36 |
|