| Line 35... |
Line 35... |
| 35 |
private CustomerRepository customerRepository;
|
35 |
private CustomerRepository customerRepository;
|
| 36 |
|
36 |
|
| 37 |
@RequestMapping(value = "/customer/mobileNumber", method = RequestMethod.GET)
|
37 |
@RequestMapping(value = "/customer/mobileNumber", method = RequestMethod.GET)
|
| 38 |
public ResponseEntity<?> getCustomerByMobileNumber(HttpServletRequest request, @RequestParam (name = ProfitMandiConstants.MOBILE_NUMBER) String mobileNumber) throws ProfitMandiBusinessException{
|
38 |
public ResponseEntity<?> getCustomerByMobileNumber(HttpServletRequest request, @RequestParam (name = ProfitMandiConstants.MOBILE_NUMBER) String mobileNumber) throws ProfitMandiBusinessException{
|
| 39 |
LOGGER.info("Request Received at url {}", request.getRequestURI());
|
39 |
LOGGER.info("Request Received at url {}", request.getRequestURI());
|
| - |
|
40 |
try {
|
| 40 |
Customer customer = customerRepository.selectByMobileNumber(mobileNumber);
|
41 |
Customer customer= customerRepository.selectByMobileNumber(mobileNumber);
|
| 41 |
CustomCustomer customCustomer = new CustomCustomer();
|
42 |
CustomCustomer customCustomer = new CustomCustomer();
|
| 42 |
customCustomer.setEmailId(customer.getEmailId());
|
43 |
customCustomer.setEmailId(customer.getEmailId());
|
| 43 |
customCustomer.setFirstName(customer.getFirstName());
|
44 |
customCustomer.setFirstName(customer.getFirstName());
|
| 44 |
customCustomer.setLastName(customer.getLastName());
|
45 |
customCustomer.setLastName(customer.getLastName());
|
| 45 |
customCustomer.setMobileNumber(customer.getMobileNumber());
|
46 |
customCustomer.setMobileNumber(customer.getMobileNumber());
|
| 46 |
customCustomer.setCustomerAddressId(customer.getId());
|
47 |
customCustomer.setCustomerAddressId(customer.getId());
|
| 47 |
if(!customer.getCustomerAddress().isEmpty()){
|
48 |
if(!customer.getCustomerAddress().isEmpty()){
|
| 48 |
CustomerAddress customerAddress = customer.getCustomerAddress().get(0);
|
49 |
CustomerAddress customerAddress = customer.getCustomerAddress().get(0);
|
| 49 |
CustomAddress customAddress = new CustomAddress();
|
50 |
CustomAddress customAddress = new CustomAddress();
|
| 50 |
customAddress.setCity(customerAddress.getCity());
|
51 |
customAddress.setCity(customerAddress.getCity());
|
| 51 |
customAddress.setCountry(customerAddress.getCountry());
|
52 |
customAddress.setCountry(customerAddress.getCountry());
|
| 52 |
customAddress.setLandmark(customerAddress.getLandmark());
|
53 |
customAddress.setLandmark(customerAddress.getLandmark());
|
| 53 |
customAddress.setLine1(customerAddress.getLine1());
|
54 |
customAddress.setLine1(customerAddress.getLine1());
|
| 54 |
customAddress.setLine2(customerAddress.getLine2());
|
55 |
customAddress.setLine2(customerAddress.getLine2());
|
| 55 |
customAddress.setName(customerAddress.getName());
|
56 |
customAddress.setName(customerAddress.getName());
|
| 56 |
customAddress.setPhoneNumber(customerAddress.getPhoneNumber());
|
57 |
customAddress.setPhoneNumber(customerAddress.getPhoneNumber());
|
| 57 |
customAddress.setPinCode(customerAddress.getPinCode());
|
58 |
customAddress.setPinCode(customerAddress.getPinCode());
|
| 58 |
customAddress.setState(customerAddress.getState());
|
59 |
customAddress.setState(customerAddress.getState());
|
| 59 |
customAddress.setId(customerAddress.getId());
|
60 |
customAddress.setId(customerAddress.getId());
|
| 60 |
customCustomer.setAddress(customAddress);
|
61 |
customCustomer.setAddress(customAddress);
|
| - |
|
62 |
}
|
| - |
|
63 |
return responseSender.ok(customCustomer);
|
| - |
|
64 |
} catch(Exception e) {
|
| - |
|
65 |
return responseSender.ok("");
|
| 61 |
}
|
66 |
}
|
| 62 |
return responseSender.ok(customCustomer);
|
- |
|
| 63 |
}
|
67 |
}
|
| 64 |
}
|
68 |
}
|