v1.0.27 #37
+5
-4
@@ -157,17 +157,18 @@ public class GaoCustomerServiceImplement extends AbstractEntityService<GaoCustom
|
||||
logger.setContent(jackson.writeValueAsString(customer));
|
||||
GaoCustomer dbCustomer = get(customer.getId());
|
||||
TimiException.requiredTrue(dbCustomer.getStoreId().equals(customer.getStoreId()), "customer.storeId invalid");
|
||||
dbCustomer.setCode(TimiJava.defaultIfEmpty(customer.getCode(), null));
|
||||
String code = TimiJava.defaultIfEmpty(customer.getCode(), null);
|
||||
{
|
||||
if (!Objects.equals(dbCustomer.getCode(), customer.getCode()) && TimiJava.isNotEmpty(customer.getCode())) {
|
||||
GaoCustomer byCode = getByCode(customer.getStoreId(), customer.getCode());
|
||||
TimiException.requiredTrue(byCode == null || !byCode.getId().equals(dbCustomer.getId()), "该姓名客户已登记");
|
||||
if (!Objects.equals(dbCustomer.getCode(), code) && TimiJava.isNotEmpty(code)) {
|
||||
GaoCustomer byCode = getByCode(customer.getStoreId(), code);
|
||||
TimiException.requiredTrue(byCode == null || byCode.getId().equals(dbCustomer.getId()), "该编码客户已登记");
|
||||
}
|
||||
if (!Objects.equals(dbCustomer.getName(), customer.getName())) {
|
||||
GaoCustomer byName = getByName(customer.getStoreId(), customer.getName());
|
||||
TimiException.requiredTrue(byName == null || !byName.getId().equals(dbCustomer.getId()), "该姓名客户已登记");
|
||||
}
|
||||
}
|
||||
dbCustomer.setCode(code);
|
||||
dbCustomer.setName(customer.getName());
|
||||
fillPinyin(dbCustomer);
|
||||
dbCustomer.setGender(customer.getGender());
|
||||
|
||||
Reference in New Issue
Block a user