chore: opt duplicate customer import
This commit is contained in:
parent
79809ab774
commit
587b9c633f
@ -105,15 +105,22 @@ public class CustomerYearToDateSaleServiceSupport
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
val customer = customerMapper.find(
|
val customers = customerMapper.list(
|
||||||
new Search(Customer.ID2, customerId2)
|
new Search(Customer.ID2, customerId2)
|
||||||
.eq(Customer.NAME, customerName));
|
.eq(Customer.NAME, customerName));
|
||||||
|
|
||||||
if (customer == null) {
|
if (customers.isEmpty()) {
|
||||||
log.warn("No customer [{}] found, ignore.", customerName);
|
log.warn("No customer [{}] found, ignore.", customerName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (customers.size() > 1) {
|
||||||
|
log.warn("Duplicate customers [{}] found, error.", customers);
|
||||||
|
throw new IllegalStateException(
|
||||||
|
"Duplicate customer found, id [" + customerId2 + "] name [" + customerName + "]");
|
||||||
|
}
|
||||||
|
|
||||||
|
val customer = customers.iterator().next();
|
||||||
val customerId = customer.getId();
|
val customerId = customer.getId();
|
||||||
customerYtdSale.setCustomerId(customerId);
|
customerYtdSale.setCustomerId(customerId);
|
||||||
customerYtdSale.setYear(StringUtils.trim(record.get(3)));
|
customerYtdSale.setYear(StringUtils.trim(record.get(3)));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user