| Line 4... |
Line 4... |
| 4 |
import java.util.List;
|
4 |
import java.util.List;
|
| 5 |
import java.util.stream.Collectors;
|
5 |
import java.util.stream.Collectors;
|
| 6 |
|
6 |
|
| 7 |
import javax.servlet.http.HttpServletRequest;
|
7 |
import javax.servlet.http.HttpServletRequest;
|
| 8 |
|
8 |
|
| - |
|
9 |
import org.apache.commons.lang3.StringUtils;
|
| 9 |
import org.apache.logging.log4j.LogManager;
|
10 |
import org.apache.logging.log4j.LogManager;
|
| 10 |
import org.apache.logging.log4j.Logger;
|
11 |
import org.apache.logging.log4j.Logger;
|
| 11 |
import org.springframework.beans.factory.annotation.Autowired;
|
12 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 12 |
import org.springframework.http.ResponseEntity;
|
13 |
import org.springframework.http.ResponseEntity;
|
| 13 |
import org.springframework.stereotype.Controller;
|
14 |
import org.springframework.stereotype.Controller;
|
| Line 54... |
Line 55... |
| 54 |
return responseSender.ok(this.toCustomAddress(customerAddress));
|
55 |
return responseSender.ok(this.toCustomAddress(customerAddress));
|
| 55 |
|
56 |
|
| 56 |
}
|
57 |
}
|
| 57 |
|
58 |
|
| 58 |
@RequestMapping(value = "/customer/add", method = RequestMethod.POST)
|
59 |
@RequestMapping(value = "/customer/add", method = RequestMethod.POST)
|
| 59 |
public ResponseEntity<?> addAddress(HttpServletRequest request, @RequestBody CustomCustomer customCustomer) {
|
60 |
public ResponseEntity<?> addAddress(HttpServletRequest request, @RequestBody CustomCustomer customCustomer) throws ProfitMandiBusinessException {
|
| 60 |
Customer customer = new Customer();
|
61 |
Customer customer = new Customer();
|
| 61 |
customer.setEmailId(customCustomer.getEmailId());
|
62 |
customer.setEmailId(customCustomer.getEmailId());
|
| - |
|
63 |
if(StringUtils.isEmpty(customer.getFirstName())) {
|
| - |
|
64 |
throw new ProfitMandiBusinessException("First Name", "Empty", "First Name required");
|
| - |
|
65 |
}
|
| 62 |
customer.setFirstName(customCustomer.getFirstName());
|
66 |
customer.setFirstName(customCustomer.getFirstName());
|
| 63 |
customer.setLastName(customCustomer.getLastName());
|
67 |
customer.setLastName(customCustomer.getLastName());
|
| 64 |
customer.setMobileNumber(customCustomer.getMobileNumber());
|
68 |
customer.setMobileNumber(customCustomer.getMobileNumber());
|
| 65 |
customer = customerService.addCustomer(customer);
|
69 |
customer = customerService.addCustomer(customer);
|
| 66 |
customCustomer.setCustomerId(customer.getId());
|
70 |
customCustomer.setCustomerId(customer.getId());
|