| Line 1208... |
Line 1208... |
| 1208 |
fofoOrderRepository.persist(fofoOrder);
|
1208 |
fofoOrderRepository.persist(fofoOrder);
|
| 1209 |
return fofoOrder;
|
1209 |
return fofoOrder;
|
| 1210 |
}
|
1210 |
}
|
| 1211 |
|
1211 |
|
| 1212 |
private Customer createAndGetCustomer(CustomCustomer customCustomer) throws ProfitMandiBusinessException {
|
1212 |
private Customer createAndGetCustomer(CustomCustomer customCustomer) throws ProfitMandiBusinessException {
|
| 1213 |
Customer customer = null;
|
- |
|
| 1214 |
try {
|
- |
|
| 1215 |
List<Customer> customers = customerRepository.selectAllByMobileNumber(customCustomer.getMobileNumber());
|
1213 |
List<Customer> customers = customerRepository.selectAllByMobileNumber(customCustomer.getMobileNumber());
|
| 1216 |
List<Customer> filtered = customers.stream().filter(x->
|
1214 |
List<Customer> filtered = customers.stream()
|
| 1217 |
x.getEmailId().equals(customCustomer.getEmailId()) &&
|
1215 |
.filter(x -> x.getEmailId().equals(customCustomer.getEmailId())
|
| 1218 |
x.getFirstName().equals(customCustomer.getFirstName()) &&
|
1216 |
&& x.getFirstName().equals(customCustomer.getFirstName())
|
| 1219 |
x.getLastName().equals(customCustomer.getLastName())
|
1217 |
&& x.getLastName().equals(customCustomer.getLastName()))
|
| 1220 |
).collect(Collectors.toList());
|
1218 |
.collect(Collectors.toList());
|
| 1221 |
if(filtered.size() > 0) {
|
1219 |
if (filtered.size() > 0) {
|
| 1222 |
return filtered.get(0);
|
1220 |
return filtered.get(0);
|
| 1223 |
}
|
- |
|
| 1224 |
} catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
- |
|
| 1225 |
LOGGER.error("Customer not found with mobileNumber [{}]", customCustomer.getMobileNumber());
|
- |
|
| 1226 |
customer = new Customer();
|
- |
|
| 1227 |
}
|
1221 |
}
|
| - |
|
1222 |
Customer customer = new Customer();
|
| 1228 |
customer.setFirstName(customCustomer.getFirstName());
|
1223 |
customer.setFirstName(customCustomer.getFirstName());
|
| 1229 |
customer.setLastName(customCustomer.getLastName());
|
1224 |
customer.setLastName(customCustomer.getLastName());
|
| 1230 |
customer.setEmailId(customCustomer.getEmailId());
|
1225 |
customer.setEmailId(customCustomer.getEmailId());
|
| 1231 |
customer.setMobileNumber(customCustomer.getMobileNumber());
|
1226 |
customer.setMobileNumber(customCustomer.getMobileNumber());
|
| 1232 |
customerRepository.persist(customer);
|
1227 |
customerRepository.persist(customer);
|